Interface config
/etc/network/interfacesauto eth0
iface eth0 inet static
address [IP]
netmask [mask]
gateway [gateway(if have one)]
DHCP
Package: DHCP3-serverSelect interface for DHCP server
/etc/default/dhcp3-serverINTERFACES="[interface_name]"
DHCP pools
dhcpd.confoption domain-name "[optional domain-name]"
option domain-name-servers [DNS server IP]
e.g.
subnet 192.168.0.0 netmask 255.255.255.0{
range 192.168.0.1 192.168.0.253;
option routers 192.168.0.254;
option broadcast-address 192.168.0.255;
}
iptables / NAT
#enable ip forwardingsysctl -w net.ipv4.ip_forward=1#flush tablesiptables -F -t natiptables -F INPUTiptables -F OUTPUTiptables -F FORWARDiptables -P INPUT ACCEPTiptables -P OUTPUT ACCEPTiptables -P FORWARD DROP#NATiptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE#firewalliptables -A FORWARD -p icmp -j ACCEPTiptables -A FORWARD -p udp --sport 53 -j ACCEPTiptables -A FORWARD -p udp --dport 53 -j ACCEPTiptables -A FORWARD -p tcp --sport 80 -j ACCEPTiptables -A FORWARD -p tcp --dport 80 -j ACCEPTiptables -A FORWARD -p tcp --sport 20:21 -j ACCEPTiptables -A FORWARD -p tcp --dport 20:21 -j ACCEPTiptables -A FORWARD -p tcp --sport 23 -j ACCEPTiptables -A FORWARD -p tcp --dport 23 -j ACCEPTiptables -A FORWARD -p tcp --sport 110 -j ACCEPTiptables -A FORWARD -p tcp --dport 110 -j ACCEPTiptables -A FORWARD -p tcp --sport 25 -j ACCEPTiptables -A FORWARD -p tcp --dport 25 -j ACCEPTiptables -A FORWARD -p tcp --sport 995 -j ACCEPTiptables -A FORWARD -p tcp --dport 995 -j ACCEPT
沒有留言:
張貼留言