搭建基于netfilter/iptables的防火墙实验环境
2006-04-03 12:36:37 来源:WEB开发网# ifconfig eth0 218.197.93.115 netmask 255.255.255.0
为了使这个地址不再计算机重新启动后消失,编辑/etc/sysconfig/network-scripts/ifcfg-eth0文件,
DEVICE = eth0
ONBOOT = yes
BROADCAST = 218.197.93.255
NETWORK = 218.197.93.0
NETMASK = 255.255.255.0
IPADDR = 218.197.93.115
增加一条静态路由:
# route add -net 218.197.93.0 netmask 255.255.255.0
接下来,配置eth1,eth1与192.168.1.0网段相连,分配给它的地址是192.168.1.1,使用ifconfig命令为它配置参数:
# ifconfig eth1 192.168.1.1 netmask 255.255.255.0
编辑/etc/sysconfig/network-scripts/ifcfg-eth1文件,
DEVICE = eth1
ONBOOT = yes
BROADCAST = 192.168.1.255
NETWORK = 192.168.1.0
NETMASK = 255.255.255.0
IPADDR = 192.168.1.1
增加一条静态路由:
# route add -net192.168.1.0 netmask 255.255.255.0
最后配置eth2,它连接192.168.2.0网段,分配的IP地址是192.168.2.1,执行下列命令:
# ifconfig eth2 192.168.2.1 netmask 255.255.255.0
- 5 -
编辑/etc/sysconfig/network-scripts/ifcfg-eth2文件
DEVICE = eth2
ONBOOT = yes
BROADCAST = 192.168.2.255
NETWORK = 192.168.2.0
NETMASK = 255.255.255.0
IPADDR = 192.168.2.1
增加一条静态路由:
# route add -net 192.168.2.0 netmask 255.255.255.0
这样网络中就有三条静态路由记录了:
# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface
更多精彩
赞助商链接