1 ubuntu 的网络配置,设置静态IP
vi /etc/network/interfaces
(1)静态IP地址
auto lo
iface lo inet dhcp
auto eth0
iface eth0 inet static //静态ip
address 192.168.0.5 // IP地址
netmask 255.255.255.0 //掩码
gateway 192.168.0.1 //网关]\
(2)默认的网络配置是dhcp自动获取auto lo
iface lo inet dhcp
auto eth0
iface eth0 inet dhcp //dhcp获取
保存退出后重启网络服务
/etc/init.d/networking restart
2 redhat和centos的网络配置vi /etc/sysconfig/network-scripts
(1)静态IP地址
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:CE:AA:5F"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR="10.91.0.30"
NETMASK="255.255.255.0"
GATEWAY="10.91.0.1"
(2)默认的网络配置是dhcp自动获取
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:0C:29:CE:AA:5F"
NM_CONTROLLED="yes"
ONBOOT="yes"
保存退出后重启网络服务service network restart