在vm中安装了redhat5.3之后,为了以后用着方便,我复制了一份,需要重新用的时候时候,和本机连接的网络有点问题,不能连接putty,需要做一些设置,才能使用,下面是配置的方法:
修改 ip 地址
先 ifconfig 看一下:
[root@node1 ~]# ifconfig
eth0
Link encap:Ethernet
HWaddr00:0C:29:D0:48:9D
inet addr:172.25.0.59
Bcast:172.25.255.255
Mask:255.255.0.0
inet6 addr: fe80::20c:29ff:fed0:489d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500
Metric:1
RX packets:2032 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:238791 (233.1 KiB)
TX bytes:8111 (7.9 KiB)
eth1
Link encap:Ethernet
HWaddr00:0C:29:D0:48:A7
inet addr:172.25.0.60
Bcast:172.25.255.255
Mask:255.255.0.0
inet6 addr: fe80::20c:29ff:fed0:48a7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500
Metric:1
RX packets:1847 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:201063 (196.3 KiB)
TX bytes:8958 (8.7 KiB)
Interrupt:19 Base address:0x1800
...................
...................
这一步主要是为了记录下两个网卡的 mac 地址。
[root@node1 ~]# cd /etc/sysconfig/network-scripts/
[root@node1 network-scripts]# mv ifcfg-eth0.bak ifcfg-eth0 -f
[root@node1 network-scripts]# mv ifcfg-eth1.bak ifcfg-eth1 -f
[root@node1 network-scripts]# vi ifcfg-eth0
修改 IP 地址,192.168.100.101 为 192.168.100.102
注意修改 HWADDR 的值为前面 ifconfig 中查看到的 eth0 的 HWaddr:00:0C:29:D0:48:9D
[root@node1 network-scripts]# vi ifcfg-eth1
同理做修改,HWADDR 的值要修改为 eth1 中的 HWaddr:00:0C:29:D0:48:A7
最后重启一下网络服务
[root@node1 network-scripts]# service network restart
Shutting down interface eth0: [OK]
Shutting down interface eth1: [OK]
Shutting down loopback interface: [OK]
Disabling IPv4 packetforwarding: net.ipv4.ip_forward = 0 [OK]
Bringing up loopbackinterface: [OK]
Bringing up interface eth0: [OK]
Bringing up interface eth1: [OK]
提示:此时两机使用 4 个 IP 或 4 个别名互 ping 应该都是通的了,如果不通,建议按照上述的操作步骤 ,
检查一下网络的配置。