Szukaj na tym blogu

środa, 8 czerwca 2011

TABLE OF CONTENTS

1. Display NIC configuration
2. Set up IP static address
3. Configure HOSTNAME on machine
4. Set up IP dynamic by DHCP
5. DHCP request/release IP address
6. Disabling interface eth0
7. Enabling interface eth0
8. Display routing table
9. Show ARP protocol cache
10. Set ARP entry
11. Delete particular entry from ARP cache


Display NIC configuration

# ifconfig -a


Set up IP static address

ifconfig etho 192.168.56.128 netmask 255.255.255.0 up
In order to plumb this IP address to eth0 interface across reboots, you have to also add the following entries in conf file :
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Should contain the following entries :

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.56.128
HWADDR=08:00:27:98:19:F2
ONBOOT=yes



Configure HOSTNAME on machine

# vi /etc/sysconfig/network
Should contain the following entries :
NETWORKING=yes
HOSTNAME=centos11

and if you want immidiate affect
# hostname centos11


Set up IP dynamic by DHCP

Across reboots
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Shoul have the following content :
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=08:00:27:98:19:F2
ONBOOT=yes

Then you have to restart network daemon.
# service network restart



DHCP request/release IP address

Release bounded IP address by dhcp protocol
# dhclient eth0 -r

Request dhcp server for new IP address
# dhclient eth0



Disabling interface eth0

# ifconfig eth0 down
OR
# ifdown eth0



Enabling interface eth0

# ifconfig eth0 up
or
# ifup eth0

Display routing table

# netstat -nr

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.56.127 0.0.0.0 UG 0 0 0 eth1

or
# route -n

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.56.127 0.0.0.0 UG 0 0 0 eth1



Show ARP protocol cache

# arp -a


Set ARP entry

arp -v -i eth1 -s centos11 00:08:27:32:88:00
You have to remember that arp cmd only allows you to add an entry when it finds dns name of centos11. So it must be configured either in /etc/hosts file or respond to dns resolver.

Delete particular entry from ARP cache

# arp -v -i eth1 -d centos44