DHCP-client on several interfaces?

Hello.

In addition to my 100/100Mbit ISP connection I have an additional 60/20Mbit connection for the next three months. I don't really have any need for that second connection but think I should try to use the bandwidth somehow. Perhaps to Tor.

Anyhow. As a router I have a FreeBSD machine with six interfaces; re0, re1, ste0, ste1, ste2 and ste3.

Primary internet connection is on ste0 and performs NAT with pf to re0, re1 and ste1. All working very good.

Now I want to connect the secondary internet connection to ste2 and pf should perform NAT from it to ste3 where a computer will use the bandwidth somehow. I want this solution in order to be able to connect to this computer form within my ordinary network.

To me this seemed like a quite simple task, but ip are assigned with DHCP from both ISPs and that's where things go wrong:

Code:
fbsd# ifconfig ste2 dhcp
fbsd# ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
        ether <cut>
        inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
ste0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether <cut>
        inet 78.11.11.11 netmask 0xffffff00 broadcast 78.11.11.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
ste1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether <cut>
        inet 10.254.239.1 netmask 0xffffff00 broadcast 10.254.239.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
ste2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether <cut>
        inet 78.11.11.11 netmask 0xff000000 broadcast 78.255.255.255
        media: Ethernet autoselect (none)
        status: no carrier
ste3: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether <cut>
        media: Ethernet autoselect (none)
        status: no carrier
re1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
        ether <cut>
        inet 172.16.1.1 netmask 0xffffff00 broadcast 172.16.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
fbsd#

As you can see BSD takes the ip from ste0 and duplicates it on ste2 instead of asking for a real ip from that ISP.

Why is this, and how can I solve this? :-/

(Had a similar problem the other month when I wanted FBSD to ask for many DHCP-adresses on one interface, the ISP gives out five. I had to give that up, it seemed unsolvable.)

Thank you in advance.
 
You can run dhclient on multiple separate interfaces without problem. However, you need to configure the dhclient.conf files to only request a default router and DNS servers from 1 DHCP server. Otherwise, the last dhclient to succeed will overwrite everything. :)
 
Thank you for your answer. Does this mean that the solution I'm looking for really isn't going to work, since the lack of a default route on the secondary connection will make it impossible to NAT that interface to another?
 
No, it does work (I use it at home, for example). But it requires a bit of "trickery" to make it work correctly. It requires either using source routing, or the route-to (I think) stuff in pf.

You may also able to use setfib(1) to start dhclient, which will give it a completely different routing table. Not sure if pf has a setfib option or not; ipfw does, and allows you to assign packets to a FIB based on source IP, dest IP, interface, etc.

You'll want to do some research into "multiple FIBs", "setfib", "source routing", and "policy routing" to see whether or not it's doable with PF (I know it's doable with IPFW).
 
Apparently, the rtable directive in pf.conf(5) can use a routing table set by setfib. Google 'pf setfib' for a couple of threads.
 
phoenix said:
You can run dhclient on multiple separate interfaces without problem. However, you need to configure the dhclient.conf files to only request a default router and DNS servers from 1 DHCP server. Otherwise, the last dhclient to succeed will overwrite everything. :)

I have a similar situation where multiple separate interfaces, sk0 and msk0 is connected to the same ISP through a VDSL2-modem. The problem is that I get an IP on the same subnet on both interfaces (not the same IP though) whereas if I connect another different computer to that same modem it gives that specific computer another IP on a separate subnet (which is the exact behaviour I'm looking for on the host with multiple interfaces.).
 
Back
Top