i am configuring a DHCP server using ubuntu 11.10 with 2 lan cards.eth0 is connected to wan on ip address:192.168.2.2/24 and eth1 connected to lan is configured with ip:192.168.10.1/24 gateway:192.168.10.1.
i have configured my /etc/dhcp/dhcp.conf as
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option routers 192.168.10.254;
option domain-name-servers 192.168.10.1, 192.168.10.2;
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.100;
}
/etc/default/isc-dhcp-server
INTERFACES="eth1"
/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 192.168.10.1
netmask 255.255.255.0
gateway 192.168.10.1
broadcast 192.168.10.255
/etc/sysctl.conf
net.ipv4.ip_forward=1
after these things i did as
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m conntrack --ctstate NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
iptables-save | sudo tee /etc/iptables.sav
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
/etc/resolv.conf is getting name server by default all the time.
i am able to use browse internet on this server but not from client side.my dhcp server is running properly from client machine i am able to ping eth1 as well as eth0 but not able to connect to internet is there any thing i am missing here. Please someone help me...
In /etc/network/interfaces do not specify a broadcast or gateway. This is done with the dhcp lease. You do need to specify a network for the DHCP however. This will configure eth1 to run on the 192.168.10/24 network. eth0 will be your gateway which is connected to your primary DHCP router. Change it to this -->
Then your dhcp.conf file will specify the routers and gateways. Use the DNS IP adresses in your /etc/resolv.conf file. These are known to be suitable in your location with your ISP. Change the routers and DNS settings in your DHCP.conf to this -->
Note: If you want to save your iptables rules, than after you set them, run this command to save it to a file --> iptables-save > /etc/iptables_rules You can see the placement to load the rules in the /etc/network/interfaces settings I provided. This will happen when the network manager is loaded/reloaded.
Let me know if this helps.