我的有线连接断开了,两个小时前它还运行正常,现在我无法建立它。我正在使用 ubuntu 12.04 这是我的 ifconfig:
ifconfig
eth0
Link encap:Ethernet HWaddr 18:03:73:5b:4d:c9
inet6 addr: fe80::1a03:73ff:fe5b:4dc9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8027 errors:0 dropped:0 overruns:0 frame:0 TX packets:1260 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2586648 (2.5 MB) TX bytes:271453 (271.4 KB)
lo
Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1489 errors:0 dropped:0 overruns:0 frame:0 TX packets:1489 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:120803 (120.8 KB) TX bytes:120803 (120.8 KB)
wlan0
Link encap:Ethernet HWaddr cc:af:78:43:84:43
inet addr:192.168.43.80 Bcast:192.168.43.255 Mask:255.255.255.0 inet6 addr: fe80::ceaf:78ff:fe43:8443/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:33351 errors:0 dropped:0 overruns:0 frame:0 TX packets:21387 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38779028 (38.7 MB) TX bytes:2683486 (2.6 MB)</$>
nmcli 开发:
DEVICE TYPE STATE
wlan0 802-11-wireless connected
eth0 802-3-ethernet disconnected
cat /etc/network/interfaces auto lo iface lo inet loopback
答案1
通过编辑/etc/network/interfaces
文件手动配置以太网接口。如果你通过 DHCP 服务器获取 IP 地址,请使用以下配置
auto eth0
iface eth0 inet dhcp
如果你有自己的静态 IP 地址,则可以使用以下配置:
auto eth0
iface eth0 inet static
address 192.168.1.5 # your static ip address
netmask 255.255.255.0 # your network netmask
gateway 192.168.1.254 # your network gateway
更多配置请查看 设置网络接口