[Linux]配置網路

大搜車-自娛發表於2012-03-23
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

相關文章