Networking related Linux Basic commands

Networking related Linux commands

Networking:
It is a connection between two or more machines to communicate with each other.

The basic requirements for networking are:
  • NIC (Network interface Controller or Card)
  • Media
  • Topology
  • Protocol
  • IP Addresses



Now we will see networking related Linux commands are as fallows.

How To check the IP address assign to all the interfaces

#ifconfig


[root@rahul ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:0A:86:5B
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe0a:865b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:660 (660.0 b)  TX bytes:3368 (3.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:23534 (22.9 KiB)  TX bytes:23534 (22.9 KiB)

[root@rahul ~]#



How to Check the ip of a particular interface

#ifconfig < adapter name >
#ifconfig eth0


[root@rahul ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 08:00:27:0A:86:5B
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe0a:865b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:660 (660.0 b)  TX bytes:4218 (4.1 KiB)


How to check hostname of the system

#hostname


[root@linuxelearn ~]# hostname
Linuxelearn.rj.com

How to check IP of the host

#hostname –i


[root@rahul ~]# hostname -i
10.0.2.4 127.0.0.1


How to check whether DNS is resolving or not ?

#host < ip address >
#host 192.168.10.10


[root@linuxelearn ~]# host 192.168.10.10
10.10.168.192.in-addr.arpa domain name pointer linuxelearn.rj.com.


#host <hostname>
#host linuxelearn.rj.com


 [root@linuxelearn ~]# host linuxelearn
linuxelearn.rj.com has address 192.168.10.10


How to change the hostname of machine ?

Check the current hostname with hostname command
The syntax for changing the hostname is

#hostname < new name >
#hostname linuxelearn.rj.com


[root@linuxelearn ~]# hostname
linuxelearn.rj.com
[root@rahul ~]# hostname rahul.rj.com


Note:  The above change is temporary and will be last only till you are logged in, if you want to change it permanently edit the /etc/sysconfig/network file and then logout and login to confirm the change.

            #vim /etc/sysconfig/network delete the previous hostname and add the new name.


[root@rahul ~]# vim /etc/sysconfig/network



NETWORKING=yes
HOSTNAME=linuxelearn.rj.com
~
~

  • Now logoff and logon and check the hostname


[root@linuxelearn ~]# hostname
linuxelearn.rj.com
 [root@rahul ~]#


Note: Once you logout and login the change will be permanent, observe the highlighted region above.




2 comments

how to instillation linux

Reply

https://linuxelearn.blogspot.in/2016/07/install-vm-virtual-box-then-click-on.html

Into this link tutorial i have explained how to install linux in detail please see the above post

Reply

Post a Comment