查看Ubuntu 中,通常有線網卡為eth0,無線網卡則為wlan0,后續增加的以此類推(可能某些無線網卡型號命名為eth1,而非wlan0)。
查看系統網卡信息
ifconfig簡介
ifconfig 是一個用來查看、配置、啟用或禁用網絡接口的工具,這個工具極為常用的(說的是喜歡動命令的人……)。
激活/禁用網卡
$sudo ifconfig 網卡設備名 up/down
查看網卡信息
$sudo ifconfig 網卡設備名
啟用/禁用網絡
sudo /etc/init.d/networking start
iwconfig簡介
用於查看無線連接情況
ubuntu@ubuntu:~$ iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
查看網卡設備信息,查看網卡生產商,型號。
ubuntu@ubuntu:~$ lspci | grep -i net
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
04:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
舉例來說,最底部,這樣的格式,這里第一行是Realtek的RTL8111/8168B有線網卡,第二行是Atheros的AR9285無線網卡。
如果你是USB網卡
lsusb
修改網卡接口名
ubuntu@ubuntu:~$ sudo nano /etc/udev/rules.d/70-persistent-net.rules
修改下列字段便成。
NAME="eth0"和 NAME="wlan0"
隨后重啟Ubuntu。