娱乐新地带论坛

娱乐新地带论坛 (https://bbs.1819.net/index.php)
-   『软件使用』 (https://bbs.1819.net/forumdisplay.php?f=11)
-   -   Linux Ubuntu Server下网卡配置 (https://bbs.1819.net/showthread.php?t=74020)

Tony 2011-06-15 11:20 PM

Ubuntu Server下网卡配置
 
1、以DHCP方式配置网卡
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp
用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
也可以在命令行下直接输入下面的命令来获取地址
sudo dhclient eth0 2。
2. 为网卡配置静态IP地址
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
保持之前的关于 lo的内容不变,即以下两行
auto lo
iface lo inet loopback
并用下面的行来替换有关eth0的行:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.250
gateway 192.168.0.1
netmask 255.255.255.0
将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart

(经本人亲测,需要额外执行sudo ifup eht0 才能设置好静态IP)
3. 网卡丢失或不能联网
  执行 sudo rm /etc/udev/rules.d/70 -persistent-net.rules (启动虚拟机网卡时常用),然后重新启动。


所有时间均为北京时间。现在的时间是 06:16 AM

©2003-2024 1819.net All rights reserved. © 2024