# Gentoo router!

## javock

Hello people...

   I've been trying to set up my little router/firewall/samba server/IMAP mail server/etc...

   What I got is :

       * courier-imap & courier-imap-ssl

       * postfix

       * shorewall

       * wondershaper

       * bridged connections (eth1 + eth2 = br0)

       * dnsmasq

       * dhcpd

       * samba

       * yahoopops

       * hotwayd

       * sshd

       * ftpd

All under 1Gb of space and got it from stage-1 for i586   :Laughing: 

Everything working... except that  :

       * I had this problem and solved it changing nics, but. My ISP binds the cablemodem to a specific MAC address, so when I restarted my new gentoo router the card that uses the cablemodem became != eth0 which is the IF I configured everything for. So changing cables won't work, also, changing module loading order can't help because all the cards are the same, ALSO changing slots didn't work. The NICs are 3COM 3c509b. Any suggestions?

       * I want to be able to do port forwarding but name-based as oposed to ip-based (I coudl set dhcp to assign fixed addresses, but I would prefer to do it true dynamic-named-based)

       * dnsmasq apears not to resolv names for the router. Perhaps has to do with the fact that /etc/conf.d/dnsmasq has br0 only. But I wouldn't know what to put in there to make it work.

I think that makes it... not really, but I got tired, if there is interest in this post, I will answer to the extent of my knowledge   :Rolling Eyes: 

Cya

----------

## Vanquirius

You might be interested in the application "net-analyzer/macchanger" to deal with the MAC address issue with your ISP (my ISP does just the same thing, if I change the NIC/MAC address the cable modem is connected to, I have to wait 6 hours to get my connection back).

----------

## javock

 *ManuChao wrote:*   

> You might be interested in the application "net-analyzer/macchanger" to deal with the MAC address issue with your ISP (my ISP does just the same thing, if I change the NIC/MAC address the cable modem is connected to, I have to wait 6 hours to get my connection back).

 

Thanks I will give it a chance... After I get this configuration script working...

Also, I hope my drive doesn't crack before that, it's making funny noises!

Thanks

----------

## DefconAlpha

when i had a cable modem, all i had to do was let the modem sit unplugged (not powered off or standby!!) for a few (maybe 2) minutes and turn it back on. the cable modem apparently had a small bit of memory for the one MAC address it assigns an ip to and will forget it after a short amount of time...

----------

## javock

Bad news, 

    Bridging doesnt work... I cant ping or access computers from the other side of it... all get the same network via dhcp and the ones in each side of the bridge have no trouble seen each other...    :Twisted Evil: 

    Any ideas? all I can think of is that the bridge config comes before the two nic (ie, /etc/init.d/net.br0 before /etc/init.d/net.eth1 and net.eth2)

here are the settings from /etc/conf.d/net :

```
iface_eth1="0.0.0.0 promisc"

iface_eth2="0.0.0.0 promisc"

iface_br0="10.0.0.1 broadcast 10.0.0.255 netmask 255.255.255.0"

iface_eth0="dhcp"

```

and part of the script that creates the bridge :

```

                /sbin/brctl addbr ${IFACE}

                /sbin/brctl addif ${IFACE} eth1

                /sbin/brctl addif ${IFACE} eth2

                /sbin/ifconfig ${IFACE} ${iface_IFACE} >/dev/null || {

                        retval=$?

                        eend ${retval} "Failed to bring ${IFACE} up"

                        return ${retval}

                }

```

comes from a copy paste from a /etc/init.d/net.eth? file...

Any pointers?

Thanks.

Edit: Found out why this is not working (but can't fix it). The shorewall firewall is somehow blocking traffic from one internal nic to the other, even though I added an 

```
loc               loc                  ACCEPT
```

in /etc/shorewall/policy

... if I reset the iptables rules, I get to see the complete network...

----------

## javock

 *DefconAlpha wrote:*   

> when i had a cable modem, all i had to do was let the modem sit unplugged (not powered off or standby!!) for a few (maybe 2) minutes and turn it back on. the cable modem apparently had a small bit of memory for the one MAC address it assigns an ip to and will forget it after a short amount of time...

 

lucky you, I have to call the ISP to reset the modem.  :Crying or Very sad: 

----------

## MooktaKiNG

I run something like that in my room, except its got a lot more stuff, like webserver, mysql etc etc.

Just wondering, what is wondershaper?

----------

## pheelay

This post wont help arrive at a solution (sorry!) but I was just wondering why have a router/firewall with a bridged connection between internal and external networks.

Does this not mean the machines on your private network will have an ip address in the same subnet as the ip provided by your cable modem/isp? And the all machines have a direct connection to the internet?

For my ignorance!

Phil

----------

## javock

 *pheelay wrote:*   

> This post wont help arrive at a solution (sorry!) but I was just wondering why have a router/firewall with a bridged connection between internal and external networks.
> 
> Does this not mean the machines on your private network will have an ip address in the same subnet as the ip provided by your cable modem/isp? And the all machines have a direct connection to the internet?
> 
> 

 

Not quite, the post isn't accurate, eth1 and eth2 are interfaces for the internal network, eth0 is the internet connection. 

This way, eth0 performs NAT for br0 and all computers on the local network are able to see each other as if they where hooked on the same hub/switch...

----------

## javock

 *MooktaKiNG wrote:*   

> I run something like that in my room, except its got a lot more stuff, like webserver, mysql etc etc.
> 
> Just wondering, what is wondershaper?

 

wondershaper is a script that creates a shapping rule for the network so interactive traffic gets  priority over bulk, downloads don't get in the way of uploads and around...

I now it can be accomplished with shorewall, but I read it had it's problems in that matter, so I decided to go for the simpler/working-whithout-a-glitch wondershaper...

Also, I haven't got the other stuff (apache, etc.) yet, because I have very limited space   :Crying or Very sad: 

Cya

----------

## MooktaKiNG

Ok, i think i understand. Thanks for the explanation.  :Smile: 

----------

