Common Linux IP commands

Commands commonly used in modifying or listing the network cards.

Display current configuration for all NIC’s

ifconfig

Display current configuration for eth0

ifconfig eth0

Assign IP address

ifconfig eth0 192.168.1.2

Ping

ping -c 3 192.168.1.1

Assign multiple IP’s

ifconfig eth0:0 192.168.1.2

Assign second IP

ifconfig eth0:1 192.168.1.3

Disable network card

ifconfig eth0 down

Enable network card

ifconfig eth0 up

View current routing table

route
route -n

View arp cache

arp “or” arp -n

Assign IP/Subnet

ifconfig eth0 192.168.1.2 netmask 255.255.255.0

Assign default gateway

route add default gw 192.168.1.1

Trace Route

traceroute www.blgr.info

Trace Path

tracepath www.blgr.info

DNS test

host www.blgr.info

Advanced DNS test

dig www.blgr.info

Reverse lookup

host 192.168.1.1

Advanced reverse lookup

dig -x 192.168.1.1

Note: You must have root privileges to make any changes. Network cards are reffered to as ethX where X are based on the position on the PCI bay e.g. eth0, eth1, etc..

Leave a Reply

Your email address will not be published. Required fields are marked *