zl程序教程

您现在的位置是:首页 >  系统

当前栏目

[Linux]配置网络

2023-09-14 08:56:50 时间
2.配置网络 
编辑/etc/network/interface 
auto eth0 
iface inet eth0 static #设置静态IP地址 
address 192.168.1.235 
netmask 255.255.255.0 
network 192.168.1.0 
broadcast 192.168.1.255 
gateway 192.168.1.1 
如果是要设置为自动获取ip地址就应该为 
auto eth0 
iface eth0 inet dhcp 
保存,退出,重启网络 
$/etc/init.d/networking restart 
此时已经可以ping通局域网地址,但外网仍不行 
Debian和Ubuntu一样,设置nameserver是在/etc/resolv.conf 里面,在其中添加一行: 
nameserver 192.168.1.1 

3.配置apt源 
vim /etc/apt/source.list 
然后进行更新源 
apt-get -s upgrade 
apt-get update