Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ -f /etc/rc.d/rc.eth1 && -f /etc/rc.d/rc.eth2 ]
- then
- /etc/rc.d/rc.eth1
- /etc/rc.d/rc.eth2
- else
- /usr/share/router/setting-IP
- fi
- chmod 755 /etc/rc.d/rc.ip_forward
- /etc/rc.d/rc.ip_forward start
- chmod 755 /etc/rc.d/rc.bind
- /etc/rc.d/rc.bind start
- route add -net $IP1 netmask $NETMASK1 dev $ETH1
- route add -net $IP2 netmask $NETMASK2 dev $ETH2
- echo "iptables -A INPUT -i $ETH1 -j ACCEPT" >/etc/rc.d/rc.iptables
- echo "iptables -A INPUT -i $ETH2 -j ACCEPT" >>/etc/rc.d/rc.iptables
- echo "iptables -A FORWARD -i $ETH1 -o $ETH2 -j ACCEPT" >>/etc/rc.d/rc.iptables
- echo "iptables -A FORWARD -i $ETH2 -o $ETH1 -j ACCEPT" >>/etc/rc.d/rc.iptables
- echo "iptables -A OUTPUT -o $ETH1 -j ACCEPT" >>/etc/rc.d/rc.iptables
- echo "iptables -A OUTPUT -o $ETH2 -j ACCEPT" >>/etc/rc.d/rc.iptables
- echo "iptables -t nat -A POSTROUTING -s $IP2/$NETMASK2 -d 0/0 -j MASQUERADE" >>/etc/rc.d/rc.iptables
- chmod 755 /etc/rc.d/rc.iptables
- /etc/rc.d/rc.iptables
Add Comment
Please, Sign In to add comment