linux 网卡

静态IP

cat /etc/sysconfig/network-scripts/ifcfg-ens33
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
BOOTPROTO=static
IPADDR=192.168.5.100
GATEWAY=192.168.5.1
DNS1=8.8.8.8
NETMASK=255.255.255.0
ONBOOT=yes
EOF

dhcp

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-ens36
DEVICE=ens36
BOOTPROTO=dhcp
ONBOOT=yes
EOF

默认网卡

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
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"
DEVICE="ens33"
ONBOOT="yes"
IPV6_PRIVACY="no"

桥接配置

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-ens35
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
NAME=ens35
DEVICE=ens35
ONBOOT=yes
BRIDGE=br0
EOF 
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-br0
TYPE=Bridge
BOOTPROTO=dhcp
DEVICE=br0
ONBOOT=yes
EOF 

你可能感兴趣的:(网络,linux,服务器,网络)