Ubuntu 命令行连接有线网络

Ubuntu 命令行连接有线网络

我想知道如何使用命令行连接到 Ubuntu 8.10 的有线网络?

就我而言,我将电缆连接到笔记本电脑,但它无法与 WICD 配合使用。所以我喜欢尝试命令行方法。

这是我的网卡的 ifconfig:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:c0:9f:8d:23:74  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:19 Base address:0x1800 

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:4457 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4457 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:493002 (493.0 KB)  TX bytes:493002 (493.0 KB)

wlan0     Link encap:Ethernet  HWaddr 00:0e:9b:ab:56:19  
          UP BROADCAST NOTRAILERS PROMISC ALLMULTI  MTU:576  Metric:1
          RX packets:1508929 errors:0 dropped:0 overruns:0 frame:0
          TX packets:768144 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:806027375 (806.0 MB)  TX bytes:78834873 (78.8 MB)

wlan0:avahi Link encap:Ethernet  HWaddr 00:0e:9b:ab:56:19  
          inet addr:169.254.5.92  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST NOTRAILERS PROMISC ALLMULTI  MTU:576  Metric:1

wmaster0  Link encap:UNSPEC  HWaddr 00-0E-9B-AB-56-19-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

更新:

尝试了 oyvindio 建议的方法。以下是失败的消息:

$ sudo dhclient3 eth0
There is already a pid file /var/run/dhclient.pid with pid 18279
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

mon0: unknown hardware address type 803
wmaster0: unknown hardware address type 801
mon0: unknown hardware address type 803
wmaster0: unknown hardware address type 801
Listening on LPF/eth0/00:c0:9f:8d:23:74
Sending on   LPF/eth0/00:c0:9f:8d:23:74
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

答案1

如果您的路由器设置为通过 dhcp 提供 IP 地址,请运行sudo dhclient3 eth0以请求eth0接口的 IP 地址。

答案2

No DHCPOFFERS received.意味着您没有联系 DHCP 服务器,也没有收到它的响应。

造成这种情况的原因可能有很多,但我不会将无线网络置于监控模式。可能是因为 DHCP 服务器只提供一组有限的 MAC 地址(每个网卡都有一个唯一的 MAC 地址),或者根本没有 DHCP 服务器。也可能是交换机的安全功能限制仅访问某些 MAC 地址。

要检查的另一件事是硬件——网线是否可以与另一台计算机兼容,以及您的计算机是否可以与另一个有线网络兼容。

测试你的理论的简单方法是退出wlan0监控模式。

相关内容