关于RHEL5中多IP,路由永久添加的做法。
[
|
2008/01/10 08:45]
|
2008/01/10 08:45]
关于RHEL5中多IP,路由永久添加的做法。
其实以前一直只知道/etc/sysconfig/network-scripts/下面有网卡的配置。但是真的不知道。永久路由的添加和为一个网卡绑定一组IP(连续的IP段)的做法。
以下做简要说明。
1:为eth0绑定一个虚拟的IP地址段。
注意:
1:文件名ifcfg-eth0-range0与文件内定义的DEVICE=eth0-range0是对应的。
2:添加这2个字段
IPADDR_START=192.168.1.1
IPADDR_END=192.168.1.5
[root@kook network-scripts]# cat ifcfg-eth0-range0
# Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
DEVICE=eth0-range0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=00:0B:6A:DF:B5:AC
IPADDR_START=192.168.1.1
IPADDR_END=192.168.1.5
NETMASK=255.255.255.0
NETWORK=192.168.103.0
ONBOOT=yes
[root@kook network-scripts]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.103.54 Bcast:192.168.103.255 Mask:255.255.255.0
inet6 addr: fe80::20b:6aff:fedf:b5ac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:468788 errors:0 dropped:0 overruns:0 frame:0
TX packets:48841 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:87271219 (83.2 MiB) TX bytes:5158855 (4.9 MiB)
Interrupt:201 Base address:0x4f00
eth0: Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:1 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:2 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:3 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:4 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
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:1960 errors:0 dropped:0 overruns:0 frame:0
TX packets:1960 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2523058 (2.4 MiB) TX bytes:2523058 (2.4 MiB)
2: 添加永久路由的方法。
[root@kook network-scripts]# cat route-eth0
192.168.1.0/24 via 192.168.103.254
192.168.2.0/24 via 192.168.103.254
192.168.3.0/24 via 192.168.103.254
192.168.4.0/24 via 192.168.103.254
192.168.5.0/24 via 192.168.103.254
[root@kook network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.5.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.4.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.3.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.2.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.1.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.103.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 0 0 0 eth0
0.0.0.0 192.168.103.254 0.0.0.0 UG 0 0 0 eth0
本文链接:http://www.52zhe.cn/read.php/141.htm
本文作者:kook(若就博客内所涉及的技术问题交流,请用下面的MSN或Gmail联系我)
联系方式:(MSN:kook#live.com) (Google talk:kookliu)
没有版权:GNU,转载时请注明“转载人”欠本人一顿饭,来日见面之时兑现!谢谢合作!
其实以前一直只知道/etc/sysconfig/network-scripts/下面有网卡的配置。但是真的不知道。永久路由的添加和为一个网卡绑定一组IP(连续的IP段)的做法。
以下做简要说明。
1:为eth0绑定一个虚拟的IP地址段。
注意:
1:文件名ifcfg-eth0-range0与文件内定义的DEVICE=eth0-range0是对应的。
2:添加这2个字段
IPADDR_START=192.168.1.1
IPADDR_END=192.168.1.5
[root@kook network-scripts]# cat ifcfg-eth0-range0
# Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
DEVICE=eth0-range0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=00:0B:6A:DF:B5:AC
IPADDR_START=192.168.1.1
IPADDR_END=192.168.1.5
NETMASK=255.255.255.0
NETWORK=192.168.103.0
ONBOOT=yes
[root@kook network-scripts]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.103.54 Bcast:192.168.103.255 Mask:255.255.255.0
inet6 addr: fe80::20b:6aff:fedf:b5ac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:468788 errors:0 dropped:0 overruns:0 frame:0
TX packets:48841 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:87271219 (83.2 MiB) TX bytes:5158855 (4.9 MiB)
Interrupt:201 Base address:0x4f00
eth0: Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:1 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:2 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:3 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
eth0:4 Link encap:Ethernet HWaddr 00:0B:6A:DF:B5:AC
inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:201 Base address:0x4f00
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:1960 errors:0 dropped:0 overruns:0 frame:0
TX packets:1960 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2523058 (2.4 MiB) TX bytes:2523058 (2.4 MiB)
2: 添加永久路由的方法。
[root@kook network-scripts]# cat route-eth0
192.168.1.0/24 via 192.168.103.254
192.168.2.0/24 via 192.168.103.254
192.168.3.0/24 via 192.168.103.254
192.168.4.0/24 via 192.168.103.254
192.168.5.0/24 via 192.168.103.254
[root@kook network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.5.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.4.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.3.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.2.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.1.0 192.168.103.254 255.255.255.0 UG 0 0 0 eth0
192.168.103.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 0 0 0 eth0
0.0.0.0 192.168.103.254 0.0.0.0 UG 0 0 0 eth0
本文链接:http://www.52zhe.cn/read.php/141.htm
本文作者:kook(若就博客内所涉及的技术问题交流,请用下面的MSN或Gmail联系我)
联系方式:(MSN:kook#live.com) (Google talk:kookliu)
没有版权:GNU,转载时请注明“转载人”欠本人一顿饭,来日见面之时兑现!谢谢合作!
关于Cut和Awk的默认分隔符(space和tab)的问题。
RHEL5的ACL的简单研究。



