Saturday, August 14, 2010

Useful IP commands in Linux

Display NIC's configurations:
# for all NIC's
$ ifconfig

# Just for eth0
$ ifconfig eth0

Assign an IP to a NIC:
$ ifconfig eth0 192.168.0.1

# assign multiple IPs
$ ifconfig eth0:0 192.168.0.1
$ ifconfig eth0:1 192.168.0.2

# assign subnet
$ ifconfig eth0 192.168.0.1 netmask 255.255.255.0

Disable/Enable NICs:
# enable
$ ifconfig eth0 up

# disable
$ ifconfig eth0 down

IP/hostname Lookup:
# look up hostname
$ host 192.168.0.1
# for more info
$ dig -x 192.168.0.1

# trace route
$ traceroute www.example.com

# trace path
$ tracepath www.example.com

# DNS test
$ host www.example.com

No comments:

Post a Comment