1

I want do configure my FreeBSD-System to use re0 as default gateway for all incoming/outgoing (internet) traffic and em0 for a specific network, so I can easily control packets with pf.

My router is a FritzBox (192.168.178.1) and both nics (re0 and em0) are connected to this. DHCP is currently enabled and they get ips in the same network.

Current Config

ifconfig

Internet:
Destination        Gateway            Flags     Netif Expire
default            192.168.178.1      UGS         re0
127.0.0.1          link#3             UH          lo0
192.168.178.0/24   link#1             U           re0
192.168.178.33     link#2             UHS         lo0
192.168.178.199    link#1             UHS         lo0

rc.conf

ifconfig_em0="DHCP"
ifconfig_re0="DHCP"

Desired Config

ifconfig (snippet)

default            192.168.178.1      UGS         re0
192.168.178.0/24   link#2             U           em0

re0

  • Default route
  • IP no matter

em0

  • Routing to 192.168.178.0/24
  • IP in network 192.168.178.0/24

Already tried

rc.conf

defaultrouter="192.168.178.1"
ifconfig_em0="inet 192.168.178.33  netmask 255.255.255.0"
ifconfig_re0="inet 192.168.178.199 netmask 255.255.255.0"
static_routes="my"
route_my="-net 192.168.178.0/24 -iface em0"

My Summary

It seems, re0 is always the first interface thats configured by OS and therefore the default gateway, including the route into my network 192.168.178.0/24.

Could anyone point me in the right direction? I don't want to use re0 for routing into my network. This should only done by em0.

Kind regards.

1 Answer 1

0

Thanks to everyone who has dealt with my question.

I found a solution. It turns out, that the order in "network_interfaces" seems to be important. My current config looks like

ifconfig_re0="NOAUTO"
ifconfig_em0="NOAUTO"

network_interfaces="em0 re0"
ifconfig_em0="inet 192.168.178.33 netmask 255.255.255.0"
ifconfig_re0="inet 192.168.178.199 netmask 255.255.255.0"
defaultrouter="192.168.178.1"

This does the trick. The desired configuration stays after rebooting. Kind regards

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .