临时修改
永久修改
1、超级用户修改配置文件:/etc/sysconfig/network-scripts/ifcfg-${网卡名},模板可以参考下边的
···
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=46cf4fc0-e6f1-4f82-8275-41e86060583c
DEVICE=ens33
IPADDR=192.168.101.11
NETMASK=255.255.255.0
GATEWAY=192.168.101.1
ONBOOT=yes
···
2.部分Linux操作系统上没有上述的配置文件,则可以参考第二种方式修改:
修改配置文件:/etc/network/interfaces
The loopback network interface
auto lo
iface lo inet loopback
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 193.168.100.200
netmask 255.255.255.0
gateway 193.168.100.1
allow-hotplug eth1
auto eth1
iface eth1 inet static
address 192.168.1.248
netmask 255.255.255.0
gateway 192.168.1.1