Ubuntu 中,通常有线网卡为eth0,无线网卡则为wlan0,
可谓是 开源自由开源道:
后续增加的以此类推(可能某些无线网卡型号命名为eth1,而非wlan0)。 ifconfig简介 ifconfig 是一个用来查看、配置、启用或禁用网络接口的工具,这个工具极为常用的,
ifconfig简介
ifconfig 是一个用来查看、配置、启用或禁用网络接口的工具,这个工具极为常用的(说的是喜欢动命令的人……)。
查看系统网卡信息
ifconfig
激活/禁用网卡
激活网卡
sudo ifconfig 网卡设备名 up
查看网卡信息
ifconfig 网卡设备名
启用/禁用网络
sudo /etc/init.d/networking start
iwconfig
用于查看无线连接情况
查看 网络参数:
root@F672XX1:~/shell/sample# cat /etc/network/interfaces
说明这里要手动编辑。
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 172.25.17.26 netmask 255.255.255.0 gateway 172.25.17.254 pre-up iptables-restore < /etc/iptables.rules pre-up iptables-restore --noflush < /etc/iptables.custom auto eth1 iface eth1 inet static address 192.168.201.1 netmask 255.255.255.0 auto eth2 iface eth2 inet static address 192.168.10.1 netmask 255.255.255.0 auto eth3 iface eth3 inet static address 192.168.203.1 netmask 255.255.255.0 auto eth6 iface eth6 inet static address 192.168.11.24 netmask 255.255.255.0
root@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
查看网卡设备信息
查看网卡生产商,型号。
root@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
修改网卡接口名
qii@ubuntu:~$ sudo nano /etc/udev/rules.d/70-persistent-net.rules
修改下列字段便成。
NAME="eth0"和 NAME="wlan0"
随后重启Ubuntu。
本文出自 “坚持就是胜利” 博客,转载请与作者联系!