1.ifconfing 可查看IP,MAC地址,子网掩码,加“-a”参数则更为详细
如:
[root@iotfundbak ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 5C:F3:FC:B9:**:**
inet addr:172.16.1.*** Bcast:172.16.1.255 Mask:255.255.255.0
inet6 addr: fe80::5ef3:fcff:feb9:****/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:140603846 errors:0 dropped:0 overruns:0 frame:0
TX packets:128843139 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:126765134324 (118.0 GiB) TX bytes:125405047296 (116.7 GiB)
Interrupt:28 Memory:92000000-92012800
eth1 Link encap:Ethernet HWaddr 5C:F3:FC:B9:**:**
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:40 Memory:94000000-94012800
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:2670151 errors:0 dropped:0 overruns:0 frame:0
TX packets:2670151 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1592149165 (1.4 GiB) TX bytes:1592149165 (1.4 GiB)
usb0 Link encap:Ethernet HWaddr 5E:F3:FC:BF:**:**
inet6 addr: fe80::5cf3:fcff:febf:****/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9064397 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:590042209 (562.7 MiB) TX bytes:468 (468.0 b)
eth0,eth1,是两个网卡
2. 查看配置文件
more /etc/sysconfig/network-scripts/ifcfg-eth0
[root@iotfundbak ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=172.16.1.***
PREFIX=24
GATEWAY=172.16.1.***
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f****
HWADDR=5C:F3:FC:B9:**:**
3. 配置网卡信息
1)配置/etc/sysconfig/network-scripts/ifcfg-eth0
2)setup命令(图形化的配置界面很简单)
网络配置->设备配置->[选择网卡配置属性,保存即可]
3)ifconfig eth0 192.168.2.166 netmask 255.255.255.0 up (即时生效)
修改完后需要
ifconfig eth0 down
ifconfig eth0 up
才能生效。
4.启动网卡服务
#service network start restart (重启) stop(关闭)
# /etc/init.d/network start restart (重启) stop(关闭)
5.配置dns
修改配置文件vi /etc/resolv.conf
NAMESERVER 202.102.152.3NAMESERVER 202.102.134.68
6.查看网卡硬件信息
$dmesg |grep -i eth
r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
eth0: RTL8102e at 0xf887e000, 00:1f:c6:c8:fd:2D, XID 04a00000 IRQ 233
r8169: eth0: link up
r8169: eth0: link up
eth0: no IPv6 routers present
r8169: eth0: link down
r8169: eth0: link up
来源: http://mount.blog.51cto.com/764124/504691