#CentOS
#Fedora
[inetrfaces]
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
#static
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.254
BROADCAST=192.168.1.255
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
#dhcp
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
[dns]
sudo vi /etc/resolv.conf
search domainname //test.domainname
nameserver 168.95.1.1
nameserver 208.67.220.220
[up&down]
sudo ifup eth0
sudo ifdown eth0
sudo /etc/init.d/network restart
[virtual nic-CentOs]
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.2.254
NETMASK=255.255.255.0
NETWORK=192.168.2.0
BROADCAST=192.168.2.255
sudo ifup eth0:0
[virtual nic-Ubuntu]
vi /etc/network/interfaces
#static
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.254
#dhcp
auto eth0
iface eth0 inet dhcp
/etc/init.d/networking restart
auto eth0:0
iface eth0:0 inet static
address 192.168.2.254
netmask 255.255.255.0
broadcast 192.168.2.255
沒有留言:
張貼留言