网络接口配置:/etc/conf.d/net
#设置静态IP
config_eth0="192.168.1.x/24"
config_eth0="192.168.1.x netmask 255.255.255.0"
#也可以指定广播地址
config_eth0="192.168.1.x/24 brd 192.168.0.255"
config_eth0="192.168.1.x netmask 255.255.255.0 broadcast 192.168.0.255"
#添加多个IP地址
config_eth0=("192.168.10.x/24" "192.168.2.x/24")
routes_eth0=("default gw 192.168.10.1" "-net 192.168.2.0/24 gw 192.168.2.1")
routes_eth0="default via 192.168.1.1" #添加默认网关
#启动和停止网络接口
/etc/init.d/net.eth0 start
/etc/init.d/net.eth1 stop
#每新增一个接口,都需要建立符号链接 net.ethX 指向 net.lo
cd /etc/init.d
ln -s net.lo net.ethX
#添加到默认启动
rc-update add default net.ethX
#查看当前的启动项
rc-update show default
#添加启动项
rc-update add net.eth0 default #default 是运行级别
rc-update add net.eth1 default
rc-update delete net.eth1 default
#DHCP方式
config_eth0="dhcp"
dhcpcd_eth0"-t 10" #dhcp服务的超时时间
dhcp_eth0="release nodns nontp nonis" #只获取ip地址
默认DNS配置/etc/resolv.conf
# Generated by dhcpcd from enp2s1
# /etc/resolv.conf.head can replace this line
domain localdomain
#nameserver 192.168.200.2
nameserver 8.8.8.8
# /etc/resolv.conf.tail can replace this line