Skip to main content

(Linux Command Line) Part 4 – Commands Line for Network Configurationin Linux (CentOS, Ubuntu)

Linux is an open supply Operating System, basically used on servers and mainframes because of its prime balance, secured and unfastened. This is a component 4 of the serial Linux Command Line – Commands Line for Network Configuration in Linux (CentOS, Ubuntu)

Serial Linux Commands:

Commands Line for Network Configurationin Linux (CentOS, Ubuntu)

1) Commands Line for Network Configuration in Linux (CentOS, Ubuntu)

Ubuntu, CentOS, and different Linux working methods believe a community card as a tool. They save the configuration within the textual content record, then load it each time the device boots up. Each laptop wishes a stressed out or wi-fi Ethernet card, indexed within the /dev listing with a reputation starting with 3 letters Eth, as an example, eth0 for the primary community card, eth1 for the second one community card…
The Network configuration recordsdata of CentOS and Ubuntu are most often other. For instance, in Ubuntu, the community configuration record is saved in /and so forth/community/interface/ whilst in CentOS, it’s saved in /and so forth/sysconfig/network- Scripts/

1.1. Commands for Checking community data in CentOS and Ubuntu

COMMAND PURPOSE / DESCRIPTION
  ifconfig -a | grep eth Check the overall choice of community playing cards within the device
  ifconfig Check the configuration (MAC, IP cope with, gateway ..) of all of the community card within the gadget
(very similar to the IPCONFIG command in Windows)
  ifconfig card-name Check the configuration of the community card named card-name (eg: ifconfìg eth0)
  course -n Check the course of packets (very similar to the ROUTE command in Windows)

1.2. Commands for Network Configuration in CentOS and Ubuntu

COMMAND PURPOSE / DESCRIPTION
  sudo ifconfig eth0 up Enable the community card eth0 in Ubuntu
  sudo ifconfig eth0 down Disable the community card eth0 in Ubuntu
 ifconfig card IP1 netmask IP2 Set the community configuration for a community card. For instance, to set the IP for eth0 to 192.168.1.100, netmask= 255.255.255.zero with this command: ifconfig eth0 192.168.1.2 netmask 255.255.255.zero
Warning: This configuration can be reset/ deleted after the device re-start
 vi /and so forth/community/interfaces Set up the community configuration record in Ubuntu with VI Text Editor
 vi  /and so forth/sysconfig/network-scripts/ifcfg-eth0 Set up the configuration for community card Ethzero in CentOS with VI Text Editor
 /and so forth/init.d/networking restart Restart the community card in Ubuntu (to use adjustments)
 provider community restart Restart the community card in CentOS (to use adjustments)
  vi /and so forth/resolv Set call servers for CentOS and Ubuntu. For instance:
nameserver 8.8.8.8
nameserver 8.8.4.4
 course upload default gw 192.168.1.1 Set 192.168.1.1 because the default gateway in Ubuntu. In distinction to the command Add, we use the command Delete (as an example: course delete default gw 192.168.1.1)
  course upload -net 192.168.5.zero masks 255.255.255.zero dev eth0 Add a static routing to the community (for the community card Ethzero). In distinction to the command Add, we use the command Delete

1.3. Other Command Line for Networking in CentOS and Ubuntu

COMMAND PURPOSE / DESCRIPTION
 netstat Display community connections (similar in Windows)
 traceroute serverA Trace packet routing to serverA
 nslookup Query the area server (call server)
 rlogin serverA Connect to a faraway device
  telnet serverA Connect to a faraway device (higher interacting than rlogin)
 rcp fileX serverA Copy a record (fileX) from the faraway server (serverA)
 ftp
Transfer recordsdata between methods on a community
 rsh commandA
Run a command on a faraway device with out logging in
 ping serverA
Check connection to a faraway device (similar in Windows)
 liquid crystal display trail
Change native folder when logged in on faraway gadget
 mesg y/n
Set choices for different customers to put in writing messages for you
 write consumer
Send a message to some other consumer
 communicate consumer Allow 2 other people to speak with every different

Now I will be able to information intimately the best way to use the above instructions to configure the community for CentOS and Ubuntu

2) Guide the best way to Configure the community in CentOS and Ubuntu

Guide how to setup the network configuration in CentOS and Ubuntu

2.1. Configure community in Ubuntu

Step 1: Open the configuration record with VI textual content editor

sudo vi /and so forth/community/interfaces

Your display screen will show the community configuration like this:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
cope with 192.168.1.2
netmask 255.255.255.1.zero
gateway 192.168.1.1

=> You can exchange the “red text” above along with your IP

If you need to make use of a dynamic IP from the DHCP server, we claim the next instructions within the record /and so forth/community/interfaces:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

Step 2: Reboot or Restart the Networking provider through the use of the next command:

/and so forth/init.d/networking restart

Step 3: In maximum circumstances, your community instrument will paintings neatly after step 2. But in some case, it’s a must to config the Nameserver. Here’s how:

sudo vi /and so forth/resolv.conf

Enter the contents of the record as beneath then Save it

nameserver 8.8.8.8
nameserver 8.8.8.4

Done !!

2.2. Configure community in CentOS

Step 1: Use the command ifconfig to test your community playing cards

Step 2: Specify which community card to config (as an example: Ethzero), then open the configuration record with VI textual content editor

vi  /and so forth/sysconfig/network-scripts/ifcfg-eth0

Your display screen will show the community configuration like this:

DEVICE=eth0
TYPE=Ethernet
ONBOOT=sure
BOOTPROTO=none
BROADCAST=192.168.1.255
HWADDR=00:25:90:C3:65:BC
IPADDR=192.168.1.100
NETMASK=255.255.255.zero
GATEWAY=192.168.1.1
DNS1=8.8.8.8

=> You can exchange the “red text” above along with your IP
If you need to make use of a dynamic IP from the DHCP server, we wish to exchange the record contents to:

DEVICE=eth0
TYPE=Ethernet
ONBOOT=sure
NM_CONTROLLED=sure
BOOTPROTO=DHCP
DNS1=8.8.8.8

Step 2: Reboot or Restart the Networking provider through the use of the next command:

/and so forth/init.d/networking restart

All finished !!
Feel unfastened to go away a remark if you wish to have any lend a hand.


Find more at: Tech Cuber

Comments

Popular posts from this blog

LG Gram 13 (2017) Review

Introduction, Design & Features It turns out love it used to be simply the day before today that LG had entered the PC marketplace within the United States. They’ve made really extensive development because the early-2016 advent of the Gram 14Z950 ; in a bit of over one quick 12 months, LG stepped forward just about each and every side of that quirky featherweight, and ended up with the well-balanced Gram 14 (2017) (dubbed the “14Z970”). The LG Gram 13 (“13Z970”, in LG-speak) you’re studying about on this article doesn’t have a predecessor, because it’s a brand spanking new fashion to LG’s lineup for 2017. That mentioned, this fashion isn’t radically other from the Gram 14 (2017) we simply discussed. Both notebooks are via and massive the similar on the subject of design and lines, the principle differentiator being bodily length. One trick the Gram 13 does have up its sleeve is a biometric fingerprint reader, a characteristic the Gram 14 (2017) oddly lacks. The Gram 13Z...

The Best Smartphones – TechSpot

Throughout the years we’ve reviewed dozens of smartphones and were given fingers on time with masses others. The excellent information is that as smartphones have matured, they have got grow to be so excellent with regards to and design that it’s getting tougher to pick out one thing you’ll really be apologetic about… or in the event you’re the glass part empty kinda particular person, they’ve grow to be so excellent that selecting the one who’s proper for you’ll be able to be a difficult job. You’ve learn the evaluations and feature shaped your personal reviews at the units you have owned and lately personal, however with our huge get admission to to units, the finest smartphones characteristic is supposed to focus on the stuff that issues, what we would purchase for ourselves primarily based in quite a few elements (specifically worth level) and thus make it more uncomplicated so that you can purchase the finest imaginable instrument. Best Overall 2017 has introduced on one of...

Magic Course

👍 Product: Magic Course 👉 Click right here to get Magic Course at discounted value whilst it is nonetheless to be had… Product Description: Discover The Real Secret Behind Getting Everything You Want In Life Using Something Called "the Shift" Technique. Forget Other Strategies For Wealth Attraction Because They Don’t Work. This Is The Real Deal For Getting Everything You Want! All orders are safe through SSL encryption – the very best business same old for on-line safety from relied on distributors. 👉 Click right here to get Magic Course at discounted value whilst it is nonetheless to be had… Find more at: Tech Cuber