wlpl
2008-01-20, 12:17 AM CST
i am setting up a linux router for my home network. i have a PPPoE connection to the internet from my ISP which gives me a dynamic IP address. i have setup the PPPoE connection on ppp0 which works fine. the other NIC, eth1, is connected to the client PC's eth0. the connection between them works fine too as they can ping each other.
i have enabled IP forwarding in the /etc/sysctl.conf file and i have also setup iptables with the following rules to carry out NAT/IP masquerading.
iptables -F
iptables -t nat -F
iptables --delete-chain
iptables -t nat --delete-chain
iptables -t nat -A POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables -A FORWARD --in-interface eth1 -j ACCEPT
when i ping or traceroute servers from the internet using their IP addresses, it works. so i assume that the things i have setup so far about routing/IP forwarding/IP masquerading are working. however, when i ping or traceroute using hostnames, it does not work. so i figure i must need to setup some sort of DNS on the linux router for my client PC to resolve hostnames with. i have read from some other linux router configuration tutorials that say that:
1) if a DHCP server on the linux router is being used to dynamically assign IP addresses to client PC, the DNS information (dynamic from ISP) will also be assigned automatically i.e. the client PC can therefore resolve hostnames. and/or,
2) setup a DNS server on the linux router and set nameserver of the client PC's /etc/resolv.conf to the linux router's eth1 IP address.
here comes the questions:
are the above 2 statements true? do i need to setup DHCP/DNS/both for my linux router to work? can i ignore 1) cuz i want to use static IP addresses for my LAN? i have read from some very simple tutorials that all i need to do are to enable IP forwarding and setup iptables for IP masquerading and the linux router should work (without worrying about the DHCP/DNS). is it really that simple? or have i missed something in setting up those two?
i have enabled IP forwarding in the /etc/sysctl.conf file and i have also setup iptables with the following rules to carry out NAT/IP masquerading.
iptables -F
iptables -t nat -F
iptables --delete-chain
iptables -t nat --delete-chain
iptables -t nat -A POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables -A FORWARD --in-interface eth1 -j ACCEPT
when i ping or traceroute servers from the internet using their IP addresses, it works. so i assume that the things i have setup so far about routing/IP forwarding/IP masquerading are working. however, when i ping or traceroute using hostnames, it does not work. so i figure i must need to setup some sort of DNS on the linux router for my client PC to resolve hostnames with. i have read from some other linux router configuration tutorials that say that:
1) if a DHCP server on the linux router is being used to dynamically assign IP addresses to client PC, the DNS information (dynamic from ISP) will also be assigned automatically i.e. the client PC can therefore resolve hostnames. and/or,
2) setup a DNS server on the linux router and set nameserver of the client PC's /etc/resolv.conf to the linux router's eth1 IP address.
here comes the questions:
are the above 2 statements true? do i need to setup DHCP/DNS/both for my linux router to work? can i ignore 1) cuz i want to use static IP addresses for my LAN? i have read from some very simple tutorials that all i need to do are to enable IP forwarding and setup iptables for IP masquerading and the linux router should work (without worrying about the DHCP/DNS). is it really that simple? or have i missed something in setting up those two?