#!/bin/bash #roted by Matrafox #radu[at]matrafox.info clear echo echo " We consider that we have 2 ethernet card." echo " eth0 internet ethernet, eth1 LAN card" echo echo " Warning" echo " If at some point you type something wrong you must stop the scrpt with CTRL+C and run it agan" echo echo echo "For the begining please type hostname= (EX: ab.matrafox.info)" read rom1 echo echo " Type the Ip of gateway that was give to ou from ISP " read rom2 echo echo > /etc/sysconfig/network echo 'NETWORKING=yes' > /etc/sysconfig/network echo 'HOSTNAME="'$rom1'"' >> /etc/sysconfig/network echo 'GATEWAY="'$rom2'"' >> /etc/sysconfig/network echo 'GATEWAYDEV="eth0"' >> /etc/sysconfig/network echo 'FORWARD_IPV4="yes"' >> /etc/sysconfig/network echo echo " Type the Ip that was give to you from ISP" read rom3 echo echo " Type the netmask that was give to you from ISP " read rom4 echo echo > /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'DEVICE=eth0' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'BOOTPROTO=static' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'IPADDR='$rom3 >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'NETMASK='$rom4 >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo echo " Type DNS1 from the ISP " read rom10 echo " Type DNS2 from the ISP " read rom11 echo > /etc/resolv.conf echo 'nameserver '$rom10 >> /etc/resolv.conf echo 'nameserver '$rom11 >> /etc/resolv.conf clear echo " Now tipe the local ip for LAN " echo " This ip must use like gateway on local station from network " echo " Some exammple " echo " 172.18.0.2-172.18.0.254 " echo " Ex: 172.18.0.1 try this here" read rom5 echo echo " Type netmask, you must use same on network workstation " echo " if you don't know what to type use" echo " 255.255.255.0 " read rom6 echo echo > /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DEVICE=eth0' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'BOOTPROTO=static' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'IPADDR='$rom5 >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'NETMASK='$rom6 >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo clear echo " WARNING - if it is something wat you type wrong type CTRL+C " echo "After the program end please reboot the sistem " echo echo echo " This program was rote by Matrafox" echo " Live like there is no tomorow, the future is uncertain !" read rom7 clear echo 'echo ''"'1'"''> /proc/sys/net/ipv4/ip_forward' >> /etc/rc.d/rc.local echo 'modprobe iptable_nat' >> /etc/rc.d/rc.local echo '/sbin/iptables -t nat -F' >> /etc/rc.d/rc.local echo '/sbin/iptables -F' >> /etc/rc.d/rc.local echo '/sbin/iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to '$rom3 >> \ /etc/rc.d/rc.local