Debian9配置網(wǎng)絡(luò)
(1)配置動(dòng)態(tài)IP
打開網(wǎng)絡(luò)配置文件 vim /etc/network/interfaces,只需設(shè)置為DHCP就可以
iface ens33 inet dhcp
(2)配置靜態(tài)IP
修改 /etc/network/interfaces 添加如下
allow-hotplug ens33
auto ens33 # 開機(jī)自動(dòng)激活
iface ens33 inet static # 靜態(tài)IP
address 192.168.3.131 # 本機(jī)IP
netmask 255.255.255.0 # 子網(wǎng)掩碼
gateway 192.168.3.2 # 路由網(wǎng)關(guān)
2、設(shè)置DNS
echo "nameserver x.x.x.x" >> /etc/resolv.conf
3、重啟網(wǎng)卡
systemctl restart networking
注意:VMware下安裝的Debian9重啟網(wǎng)卡后,靜態(tài)IP不生效,重啟系統(tǒng)后才會(huì)生效。