用户工具


centos | ubuntu | ip | 配置 | 网络

centos

vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=08:00:27:0f:d7:bb
BOOTPROTO=static
BROADCAST=10.0.2.255
IPADDR=10.0.2.10
NETMASK=255.255.255.0
GATEWAY=10.0.2.1
DNS1=10.0.2.1
DNS2=8.8.8.8
  • 重启网络

ubuntu

sudo vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 10.0.2.100
netmask 255.255.255.0
gateway 10.0.2.1
broadcast 10.0.2.255

vim /etc/resolvconf/resolv.conf.d/base

nameserver 192.168.0.1
nameserver 8.8.8.8
  • 重启网络。无效就重启系统