rc.local nat

来源:互联网 发布:sql创建一个触发器 编辑:程序博客网 时间:2024/05/24 07:19

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
ifconfig eth0 10.1.10.202 netmask 255.255.0.0 broadcast 255.255.0.0 up
ifconfig eth1 192.168.10.1 netmask 255.255.255.0 broadcast 255.255.255.0 up
ip r a default via 10.1.1.254 dev eth0 table 254
ip r a default via 10.1.1.254 dev eth0 table 253

echo nameserver 10.1.1.253 >/etc/resolv.conf

echo "220.181.37.4 baidu
127.0.0.1       localhost.localdomain   localhost
220.181.37.4 baidu
220.128.160.39 istar
10.1.5.23 uud" >/etc/hosts
echo "#
# reserved values
#
#255   local
#254    main
#253    default
#100    net192
#0      unspec

#
# local
#
#1    inr.ruhep
">/etc/iproute2/rt_tables

echo 1 > /proc/sys/net/ipv4/ip_forward

echo 1 > /proc/sys/net/ipv4/ip_dynaddr
echo 100 net19 >>/etc/iproute2/rt_tables

ip r a default via 10.1.1.254 dev eth0 table 100
ip r a 10.1/16 via 10.1.1.202 dev eth0 table 100
ip r a 192.168.10/24 via 192.168.10.1 dev eth1 table 100

ip ru a from 192.168.10/24 iif eth1 table 100 prio 9999
ip ru a from 192.168.10.92 dev eth1 nat 192.168.100.92 table 100 prio 9998
iptables -F FORWARD
iptables -F INPUT
iptables -F OUTPUT
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 10.1.10.202
iptables -t nat -A PREROUTING -d 100.100.100.100 -j DNAT --to-destination 10.1.5.23
ip r l t 100
ip r l
ip ru
ln -s /etc/rc.local /etc/rc5.d/S99local


touch /var/lock/subsys/local

 

568B
1    2   3   4    5    6   7   8
橙白 橙 绿白 蓝 蓝白 绿 棕白 棕
绿白 绿 橙白 蓝 蓝白 橙 棕白 棕

 

1G

绿白 绿 橙白 蓝   蓝白 橙 棕白 棕
橙白 橙 绿白 棕白 棕   绿 蓝   蓝白

Or

1    2   3   4    5    6   7   8
橙白 橙 绿白 棕白 棕   绿 蓝   蓝白
绿白 绿 橙白 蓝   蓝白 橙 棕白 棕

 

13 26 47 58