# Gentoo as Router with UPnP[solved]

## shaumux

I am making my gentoo PC as a router.

I was reading the official guide.

The wan connection is a usb modem connecting through ppp.

How do i fit it in the guide?Last edited by shaumux on Wed Apr 15, 2009 5:27 pm; edited 1 time in total

----------

## d2_racing

http://www.gentoo.org/doc/en/home-router-howto.xml#doc_chap3

Your's is ADSL.

----------

## shaumux

No its not adsl its a 3G wireless evdo modem something like a cellphone modem.

I have to issue several init commands before connecting.

I normally use kppp or wvdial to connect

----------

## Inodoro_Pereyra

If you skip the bluetooth part, This guide may help.

Cheers!

----------

## shaumux

 *Inodoro_Pereyra wrote:*   

> If you skip the bluetooth part, This guide may help.
> 
> Cheers!

 The tutorial talks about setting up the internet connection using the modem.

I have already done that.

I want to route the connection to other pcs and i can't understand how to fit this type of connection in the wan part of the official tutorial.

It talks about using eth1 as the adsl port but mine is a usb modem dialled using kppp or wvdial.

----------

## Inodoro_Pereyra

Well, is exactly the same, just replace any occurrence of eth1 by your WAN device name.

You can get the device name by simply running ifconfig.

As said in the official guide:

 *Quote:*   

> Copy and paste these examples ...
> 
> # export LAN=eth0
> 
> # export WAN=#here goes the device name, ppp0 or whatever

 

Cheers!

----------

## Simba7

Darn.. I did this with FreeBSD awhile ago on a 56k Dialup connection.. Ahh.. FreeBSD 3.4..

I'll have to do some digging..

----------

## shaumux

ok the wan device name ppp0.

Can i somehow map it to some kind of virtual eth2 maybe?

----------

## NeddySeagoon

shaumux,

Use the name ppp0 where the guide says to use eth0 or eth1 ... whichever interface is connected to the internet.

----------

## shaumux

Thanks for the help.

The router setup is working as i want it to.

Now is there some way to implement upnp for dynamic port forwarding but only for a specific system?

Also can i use nat based on mac address and not on ip address as i want to give net access to specific system.

----------

## Inodoro_Pereyra

You can filter any kind of traffic by mac address issuing for example:

```
iptables -A INPUT -m mac --mac-source 00:11:22:33:44:55 -j DROP
```

Im interested in upnp automagically port forwarding too. Let's see if someone else can give us a clue.

Cheers!

----------

## shaumux

 *Inodoro_Pereyra wrote:*   

> You can filter any kind of traffic by mac address issuing for example:
> 
> ```
> iptables -A INPUT -m mac --mac-source 00:11:22:33:44:55 -j DROP
> ```
> ...

 can i do?

```
iptables -A INPUT -m mac --mac-source 00:11:22:33:44:55 -j ACCEPT
```

Will it override the ip based rules?

----------

## Inodoro_Pereyra

Hi againg, iptables list of directives is parsed sequentially, so any rule ending with -j ACCEPT will override any denying rule parsed after that one. No matter if is mac based or ip based.

Cheers!

----------

## shaumux

I found this tutorial for upnp implementation on linux

http://www.gentoo-wiki.info/HOWTO_Setup_UPnP_with_IPTables

From this tutorial i don't understand whats

route add -net 239.0.0.0 netmask 255.0.0.0 <int_if>

and why 239.0.0.0?

what is <int_if>

----------

## shaumux

Ok i got it to work the <int_if> is the internal interface

Thanks for the help.

----------

