Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have read other posts and google on this but I am still stuck... hoping a new one will help

I am attempting to setup a Linux (Fedora 14) firewall between my wireless router and external modem. I have the machine built and it has 2 network cards and fedora is installed and ready to go.

I have installed DHCP and DNS, but they are not yet configured...

How do I configure the machine to pass traffic from eth0 to eth1? I think I can get iptables going if I could just get this first step done.

I hope this question makes sense.

share|improve this question

closed as off topic by womble, mailq, Steven Monday, Bart De Vos, dyasny Oct 12 '11 at 9:41

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
how do you minus one a question? –  Siriss Oct 8 '11 at 23:36
    
I switched to Ubuntu. I am stuck on the idea of the passthrough. I can picture it in my head but editing the /etc/network/interfaces file is giving me trouble. I wrote a comment below. –  Siriss Oct 11 '11 at 0:13

1 Answer 1

This is my basic template for firewall on an ubuntu machine, I think this works on fedora as well

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -F

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

I save it on a file in /etc/init.d/ and make a symlink to /etc/rc2.d, change mode to +x. You can also opt to DROP all packets forwarded to eth1 and open selected ports only.

For DHCP, the following is a basic template, add it inside your dhcpd.conf

subnet  192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.30 192.168.0.250;
option routers 192.168.0.10;
option broadcast-address 192.168.0.255;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.0.10;
}

host YourServer {
hardware ethernet <your-internal-nic-MAC-address>;
fixed-address 192.168.0.10;
}

As for DNS, insert your service provider's DNS IPs on /etc/resolv.conf and in /etc/bind/named.conf.options. You can also use Google's public DNS IPs or OpenDNS.

EDIT

The following should be on your /etc/network/interfaces

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
  address 192.168.0.10
  netmask 255.255.255.0
  network 192.168.0.0
  broadcast 192.168.0.255

Since your eth0 is on DHCP and I assume is connected to your modem (internet interface), it will request for the IP and Gateway addresses from the modem. The eth1 will be your internal-network interface and is on static IP.

share|improve this answer
    
thanks! I will see if I can get this working. –  Siriss Oct 8 '11 at 22:28
    
I switched to Ubuntu. Fedora was a pain. So I realized that it was not working as stated earlier. The firewall configuration is working, but I had the computer setup incorrectly and now it is still not passing traffic through. I am editing the /etc/network/interfaces and I am curious as to how I set eth0 to have a dynamic IP, gateway and subnet. Then have eth1 have a static IP, subnet, and gateway. I hope this makes sense... or if I am completely doing this wrong I would love to learn Thank you! –  Siriss Oct 11 '11 at 0:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.