Saturday, 29 August 2015

RHEL7 Linux Network Configuration and Troubleshooting CLI Commands



After this article you can able to manage Network interface effectively and you simple troubleshoot.

 STEP1: To check the server IP Address

~]#ifconfig
Command 'ifconfig' will show you IP address of all the Ethernet interfaces. Above command will work in RHEL 4/5/6/7 versions.

~]#ifconfig ens33 

 
If you specify Ethernet device name then it will show the details of that particular device only.

 ~]#ip addr show



above command will work in RHEL 7 version , it not works in below RHEL7 version. it is also same as 'ifconfig' in previous versions.

~]#ip addr show ens33



 Specify the Network device name will show only that particular device details.


STEP 2: Assign IP Address

 ~]# nmtui
    NetworkManager text user interface (TUI) tool,  nmtui, provides a text interface to configure networking by controlling NetworkManager.

 









"Select Edit a connection" option if you want to change the IP / Assign the IP


Select the Interface name if you have multiple interfaces select it carefully


 click on OK.

Then restart the Network services by entering below command
 ~]# systemctl restart network
 ~]# systemctl status network

 Restart/reaload the service to effect the new changes

Do not run any service by calling /etc/init.d/servicename start|stop|restart|status directly.
  

    Note that in Red Hat Enterprise Linux 7, NetworkManager is started first, and /etc/init.d/network checks with NetworkManager to avoid tampering with NetworkManager's connections. NetworkManager is intended to be the primary application using sysconfig configuration files and /etc/init.d/network is intended to be secondary, playing a fallback role.  

 You can also edit the /etc/sysconfig/network-scripts/ifcfg-ens33 file to Assign/Modify the IP Address.


DEVICE=ens33
BOOTPROTO=none
ONBOOT=yes
PREFIX=24
IPADDR=192.168.234.135
GWATEWAY=192.168.1.1 
DNS1= 192.168.234.10

STEP 3: Bring UP / Bring DOWN the interfaces

~]#ifup interface-name 
~]#ifdown interface-name
~]#nmcli dev disconnect  interface-name
~]#nmcli dev up interface-name


To bring down the interface you can use 'nmcli dev disconnect interface-name' and 'ifdown interface-name'

To bring up the interface you can use 'nmcli con up interface-name' and 'ifup interface-name'

~]#nmcli connection reload

To reaload the interface configuration

Verify the Routing Table

~]#netstat -r


 To see the default routing table above command is useful
 

 Trace the device path

 ~]#traceroute <IP Address>
 
 
 To Trace the network route path traceroute command is useful
 

 Verify Interface Status and Banwidth Speed

 ~]#ethtool interface-name
 
 
 
 You can verify the interface status and bandwidth using above command.
 

Find out Host IP Address and CNAME in Domain

 ~]#host host-name
 ~]# host -t a localhost
 

 to find host IP address and its domain name above command is useful
 
~]# host -t cname localhost
 
find out domain cname record 

Check DNS resolution

~]# nslookup IP-Address
~]# dig IP-Address

 
 

Please do not forgot to Add your comment about this post.

No comments:

Post a Comment