更改服务器默认网络接口

更改服务器默认网络接口

我有一台带有有线和无线以太网的服务器。我相信设备驱动程序一切正常,并且 WPA2 配置正确。我使用 system-network-config 设置了两个设备;eth0 我分配了静态 IP 192.168.0.100,wlan0 我分配了静态 IP 192.168.0.101。(请确认两个 NIC 应该具有不同的 IP)

如果我拔下 CAT-5 并重新启动网络,我就可以从 LAN 上的其他 PC ping 服务器的无线 IP (192.168.0.101)。

但是,我无法从服务器 ping 通路由器或 LAN 上的其他 PC。尝试时,我得到的是 From 192.168.0.100 icmp_seq=1 Destination host unreachable。请注意,192.168.0.100 是 eth0 而不是 wlan0。

因此,我的服务器似乎配置为仅使用 eth0。或者它可能在同一个子网上有两个接口,但我真的不知道。理想情况下,如果连接,它将使用 eth0,然后默认使用 wlan0。我该怎么做?谢谢

PS. 如果我的理解不正确,请见谅,因为不幸的是,我目前还远不是专家。

[root@desktop ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=desktop.example.com

[root@desktop ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 88:51:FB:51:DF:70
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::8a51:fbff:fe51:df70/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2744 errors:0 dropped:0 overruns:0 frame:0
          TX packets:438 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:268005 (261.7 KiB)  TX bytes:57967 (56.6 KiB)

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:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1344 (1.3 KiB)  TX bytes:1344 (1.3 KiB)

wlan0     Link encap:Ethernet  HWaddr B8:76:3F:69:31:95
          inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ba76:3fff:fe69:3195/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8736 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3078 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4494490 (4.2 MiB)  TX bytes:265995 (259.7 KiB)

[root@desktop ~]# iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"Wired"
          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:18:E7:F0:85:CE
          Bit Rate=1 Mb/s   Tx-Power=27 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=63/70  Signal level=-47 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:5   Missed beacon:0

eth0      no wireless extensions.

[root@desktop ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
IPV6INIT=yes
IPV6_AUTOCONF="yes"
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
UUID="05b28da3-5efd-4dff-bdf1-e1aeb842fe65"
HWADDR=88:51:fb:51:df:70
PREFIX=24
DNS1=8.8.8.8
DOMAIN=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="System eth0"
LAST_CONNECT=1372676618
USERCTL=no
DNS2=8.8.4.4
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.0.1

[root@desktop ~]# cat /etc/sysconfig/network-scripts/ifcfg-wlan0
GATEWAY=192.168.0.1
IPV6INIT=no
DNS2=8.8.4.4
BROADCAST=192.168.0.255
USERCTL=no
DNS1=8.8.8.8
BOOTPROTO=none
TYPE=Ethernet
DEVICE=wlan0
NETMASK=255.255.255.0
IPADDR=192.168.0.101
NETWORK=192.168.0.0
#changed from no to yes by Michael Reed
ONBOOT=yes
HWADDR=b8:76:3f:69:31:95

[root@desktop ~]# service network status
Configured devices:
lo eth0 wlan0
Currently active devices:
lo wlan0 eth0

[root@desktop ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
[root@desktop ~]#

相关内容