# Using PC as a NAT device



## trybeingarun (Jan 15, 2010)

Hi!
I have a modem with only one ethernet port and I have two PCs. However in one of my PCs I have two NICs. Using this set up will it be possible to have internet connection in both of my PCs? If so how to do that?

( Well, the hackish solution will be to throw the modem away and buy a better modem. But that is not what I am looking for:e )


----------



## DutchDaemon (Jan 15, 2010)

If the modem does DHCP (which I assume), why not get a simple switch and hang both PCs on that?


----------



## Alt (Jan 15, 2010)

1. If modem have nat ability and you have a switch, look at DutchDaemon's advice. Easy path =)
2. You can setup nat on pc which have 2 nics. You must connect pcs with cross-cable and it can work well.
3. If modem have nat ability, you can set bridge between router's nics and give address to both computers.


----------



## trybeingarun (Jan 15, 2010)

I just believed there's about just enough hardware with me to do the job...


----------



## trybeingarun (Jan 15, 2010)

@Alt

```
2. You can setup nat on pc which have 2 nics. You must connect pcs with cross-cable and it can work well.
```
I guess I was looking for more this kind of solution. I guess there should be an easy way to do set up a NAT. I will look at the handbook and get back


----------



## phoenix (Jan 15, 2010)

You'd be better off going with a bridge setup, than a NAT setup.  That way, the router, the PC with 2 NICs, and the other PC would all be on the same IP subnet (use that same set of IPs).  Things would just work smoother.

Be sure to only assign an IP to the NIC that is connected to the router.  The other NIC doesn't need an IP.

See if_bridge(4) and ifconfig(8) for details.

Would look something like:

```
[Internet]----[router]-----[NIC1 on PC1][NIC2 on PC1]-----[PC1]
                    IP1       IP2                          IP3
```
Where IP1, IP2, and IP3 are IPs in the same subnet (192.168.0.1, 192.168.0.2, 192.168.0.3 for example).


----------

