Monday, December 15, 2014

linux networking commands

Leave a Comment
In this articles, how to use linux networking commands to configuration and troubleshooting in linux system.

linux networking commands

Network configuration

A some the command line linux networking command to network configuration such as: ifconfig, ifup, ifdown, route, etc.

ifconfig command 

This is command to configuration network interface, or to display the current configuration such as ip address , MAC, up or down network interface, etc. as below:

[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:30:55:8C
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20c:29ff:fe30:558c/64 Scope:Link
          RX packets:35817 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3872 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7610671 (7.2 MiB)  TX bytes:319083 (311.6 KiB)
lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Syntax ifconfig command :

ifconfig [Interface] [Option]
  • Interface: such as eth0 or lo interface as above
  • Option: such as up, down, metric, netmask, etc.
  • The configuration with ifconfig command the lost after reboot system.
To details more information ifconfig command use: man ifconfig in terminal 

For example ifconfig command :

Enable or disable network eth0 interface:
ifconfig eth0 up
ifconfig eth0 down
Assign ip address:
ifconfig eth1 netmask

ifup command

This is command the basic to bring network interface up.

Syntax ifup command:

ifup device-name

For example ifup command:

ifup eth0

ifdown command

This is same ifup command to bring network interface down.

Syntax ifdown command:

ifdown device-name

For example ifdown command:

ifdown eth0

ifcfg command 

This is command to configuate a particular interafce as change, dell ip address etc.

Syntax ifcfg command:

ifcfg [Interface] [Option]

For example ifcfg command:

To change ip from to
ifcfg eth1 del
ifcfg eth1 add

route command

This is command to display or modify routing table.

Syntax route command

route add -net [NETwork] netmask [MASK] gw [GATEWAY]

For example route command

route add -net netmask gw

Network troubleshooting

A some the command line linux networking commands to network troubleshooting such as netstat, ping, tcpdump, etc.

Netstat command

This is command to print network connections, interface statistics,etc. it's has many different option.

For example netstat command:

List out all connections
netstat -a

Ping command

This is command to send ICMP ECHO_REQUEST to network hosts. It's a useful in network troubleshooting

Syntax ping command

ping ip-or-host

For example ping command:


Hostname command

This is command to show or set the system’s host name

traceroute command

This is command show the route of a packet

Syntax traceroute command:

traceroute ip-or-hostname

tcpdump command 

This is a command to captures packet network interafce

Conclude: linux networking commands useful for system admin to configuration and troubleshooting network.

Copyright by:


Post a Comment