180 条记录
15 私有链接
15 私有链接
配置 DHCP
编辑 /etc/network/interfaces 文件,确保以下内容存在:
auto eth0
iface eth0 inet dhcp
重新启动网络接口:
/etc/init.d/networking restart
或者
ifup eth0
设置固定 IP 地址
编辑 /etc/network/interfaces 文件,添加如下配置:
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 1.1.1.1
重新启动网络接口:
/etc/init.d/networking restart
或者
ifup eth0
或者
rc-service networking restart
验证配置:
ip a