Wednesday, February 25, 2015

linux command (network)

Add Network (network command)

(1)add interface
[root@server ~]#cd /etc/sysconfig/network-scripts
[root@server ~]#vi ifcfg-eth0
DEVICE="eth2"
BOOTPROTO="dhcp"
HWADDR="00:02:C9:27:59:FE"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPV6INIT="no"

(2)If set ip, will not active after reboot.
When we set some ip address, after reboot or services restart will not active. This means that we have to kill the temporary store ip address. This often occur when we had a dhcp Ip address, then we wants to change to a static. But i also found out that if i wants to change a new network card, will also happen, the ip will not change.

Please set ip address first, then clear this.
[root@server ~]#cd /etc/udev/rules.d
[root@server ~]#rm 70-persistent-net.rules

(3) show ip address
[root@server ~]#ifconfig

(4) show ip interface
[root@server ~]#ip a












(5) ethtool - query or control network driver and hardware settings
ethtool ethernet interface
#ethtool eth0
This will let you see your link rate, support wake on lan, lan detect or not, and so on.

(6) enable your interface
#ifdown eth0
#ifup eth0

(7) ping
ping ip address
ping -c 1 ipaddress  ==>ping one second

(8) Search dhcp client ip address, or bmc ip address
cat /var/log/messages | grep BMC MAC address
example: cat /var/log/messages | grep  xx:xx:xx:xx:xx:xx

(9) changed Server name 
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=putXX




No comments:

Post a Comment