(Linux Command Line) Part four – Commands Line for Network Configuration in Linux (CentOS, Ubuntu)

0
138

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

Serial Linux Commands:

 ? Part 1 – Linux Commands for Server Management and Monitoring
 ? Part 2 – Linux Commands for File and Folder/ Directory Management
 ? Part three – Linux Commands for File Editor in Linux (CentOS, Ubuntu)
 ? Part four – Linux Commands for Network Configuration in Linux (CentOS, Ubuntu)
 ? Part five – Other Useful Linux Commands (CentOS, Ubuntu) you want to understand

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

Bonus: E book “Total Linux Command Line“, Download Here

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

Ubuntu, CentOS, and different Linux running programs believe a community card as a tool. They save the configuration within the textual content report, then load it each and every time the machine boots up. Each laptop wishes a stressed or wi-fi Ethernet card, indexed within the /dev listing with a reputation starting with 3 letters Eth, for instance, eth0 for the primary community card, eth1 for the second one community card…

The Network configuration information of CentOS and Ubuntu are normally other. For instance, in Ubuntu, the community configuration report is saved in /and so on/community/interface/ whilst in CentOS, it’s saved in /and so on/sysconfig/network- Scripts/

1.1. Commands for Checking community data in CentOS and Ubuntu

COMMAND PURPOSE / DESCRIPTION
  ifconfig -a | grep eth Check the full choice of community playing cards within the machine
  ifconfig Check the configuration (MAC, IP deal with, gateway ..) of the entire community card within the system
(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 machine re-start
 vi /and so on/community/interfaces Set up the community configuration report in Ubuntu with VI Text Editor
 vi  /and so on/sysconfig/network-scripts/ifcfg-eth0 Set up the configuration for community card Ethzero in CentOS with VI Text Editor
 /and so on/init.d/networking restart Restart the community card in Ubuntu (to use adjustments)
 carrier community restart Restart the community card in CentOS (to use adjustments)
  vi /and so on/resolv Set call servers for CentOS and Ubuntu. For instance:
nameserver eight.eight.eight.eight
nameserver eight.eight.four.four
 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 (for instance: course delete default gw 192.168.1.1)
  course upload -net 192.168.five.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.three. Other Command Line for Networking in CentOS and Ubuntu

COMMAND PURPOSE / DESCRIPTION
 netstat Display community connections (identical in Windows)
 traceroute serverA Trace packet routing to serverA
 nslookup Query the area server (call server)
 rlogin serverA Connect to a far flung machine
  telnet serverA Connect to a far flung machine (higher interacting than rlogin)
 rcp fileX serverA Copy a report (fileX) from the far flung server (serverA)
 ftp
Transfer information between programs on a community
 rsh commandA
Run a command on a far flung machine with out logging in
 ping serverA
Check connection to a far flung machine (identical in Windows)
 liquid crystal display trail
Change native folder when logged in on far flung system
 mesg y/n
Set choices for different customers to put in writing messages for you
 write consumer
Send a message to any other consumer
 communicate consumer Allow 2 other folks 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

Guide how to setup the network configuration in CentOS and Ubuntu
Guide the best way to setup the community configuration in CentOS and Ubuntu

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

2.1. Configure community in Ubuntu

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

sudo vi /and so on/community/interfaces

Your display screen will show the community configuration like this:

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

=> You can change the “red text” above together with your IP

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

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

Step 2: Reboot or Restart the Networking carrier by means of the use of the next command:

/and so on/init.d/networking restart

Step three: In maximum instances, your community instrument will paintings smartly after step 2. But in some case, you need to config the Nameserver. Here’s how:

sudo vi /and so on/resolv.conf

Enter the contents of the report as under then Save it

nameserver eight.eight.eight.eight
nameserver eight.eight.eight.four

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 (for instance: Ethzero), then open the configuration report with VI textual content editor

vi  /and so on/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=eight.eight.eight.eight

=> You can change the “red text” above together with your IP

If you need to make use of a dynamic IP from the DHCP server, we want to exchange the report contents to:

DEVICE=eth0
TYPE=Ethernet
ONBOOT=sure
NM_CONTROLLED=sure
BOOTPROTO=DHCP
DNS1=eight.eight.eight.eight

Step 2: Reboot or Restart the Networking carrier by means of the use of the next command:

/and so on/init.d/networking restart

All performed !!

Feel unfastened to go away a remark if you want any assist.

Changer.com - Instant Exchanger