Showing posts with label Linux Networking. Show all posts
Showing posts with label Linux Networking. Show all posts

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:192.168.1.244  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe30:558c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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:127.0.0.1  Mask:255.0.0.0
          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]
Note:
  • 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 192.168.1.113 netmask 255.255.255.0

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 192.168.1.113 to 192.168.1.115
ifcfg eth1 del 192.168.1.113
ifcfg eth1 add 192.168.1.115

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 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1

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:

ping huuphang.blogspot.com 

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: www.linuxoperatingsystem.info http://goo.gl/kMscJ4
Read More...