单网卡配置:
vim /etc/network/interfaces
添加:
auto ensxx #自启动
iface ensxx inet static #静态IP
address #ip地址
netmask #子网掩码
gateway #网关
多网卡配置:
vim /etc/network/interfaces
添加:
allow-hotplug ensxx #首选网卡
iface ensxx inet static #静态IP
address #ip地址
netmask #子网掩码
gateway #网关
auto ensxx #自启动
iface ensxx inet static #静态IP
address #ip地址
netmask #子网掩码
gateway #网关
桥接网卡:
apt-get install -y bridge-utils
vim /etc/network/interfaces
添加:
auto lo br0
iface lo inet loopback
iface ensxx inet static
bridge_ports ensxx
address #ip地址
netmask #子网掩码
gateway #网关
实例:
[root@Rserver ~]# vi /etc/network/interfaces
auto ens33
iface ens33 inet static
address 10.10.100.254/24
#补充命令
ip address //查询IP配置
查询: