# Routage from FreeBSD (Solved)



## Logicien (Jan 10, 2022)

Hello,
FreeBSD is one of the clients in my local wireless network where all devices see all devices and can access to their services through a Linux Access Point. When I plug my Raspberry Pi to the laptop with an RJ45 cable who is FreeBSD, both can connect to the other on this little locale wired network. If I set the Pi to have FreeBSD as it's Ethernet and Internet default route I cannot access to Internet with the Pie but FreeBSD does.

So, I have play with ipfw, natd and other utilities but I cannot  give to the Pie Internet access through FreeBSD on my laptop. I am looking for an easy to do it contrary to an headache where I am stuck. I have try this without remarks but in this way even FreeBSD stop to access to Internet.

# Firewall
# accept_sourceroute="YES"
# firewall_enable="YES"
# firewall_nat_enable="YES"
# firewall_type="open"
# forward_sourceroute="YES"
# gateway_enable="YES"
# natd_enable="YES"
# natd_interface="wlan0"


----------



## covacat (Jan 10, 2022)

```
# firewall_enable="YES"
# firewall_type="open"
# gateway_enable="YES"
# natd_enable="YES"
# natd_interface="wlan0"
```
thats all you need
make sure you have ipfw and ipdivert kernel modules loaded


----------



## Logicien (Jan 11, 2022)

I have try all possible combinations in what you say for rc.conf. With natd_interface="wlan0" I cannot connect to FreeBSD. The rest allow connexions and Internet to FreeBSD but never the Pie can have Internet access passing through FreeBSD who I say it, is not the gateway to Internet.

I have disable many services to have a better boot performance. Maybe I have disable a critical one. I'll show you my active services after I will reboot to FreeBSD. On ArchLinux, always on the Toshiba laptop, the Pie have Internet access.


----------



## Logicien (Jan 13, 2022)

There was two problems in my FreeBSD configuration to forward my Pi to Internet. First FreeBSD need to have an IP configuration itself to Internet and it take time before wpa_supplicant and dhclient get it. During that time Natd try to know the ip of wlan0 and cannot find it and fail at boot time. In plus Natd block the shutdown with it's process that FreeBSD cannot kill.

So I turned myself to ipfw to do the nat work and it work perfectly without any break. Here is my rc.conf for firewalling

# Firewall
firewall_enable="YES"
firewall_nat_enable="YES"
firewall_nat_interface="wlan0"
firewall_type="open"
gateway_enable="YES"
ipnat_enable="NO"
natd_enable="NO"
natd_interface="wlan0"

I turned myself to ntpd instead of ntpdate who giveup before wlan0 get an ip configuration. FreeBSD need to access to Internet before the services who need it start. I try to speedup dhclient and dhcpcd but sometimes they are fast and sometimes they are slow to get the IP address of wlan0. This can be related to hostapd and dnsmasq that I use on Linux as Access Point. Basically it is solved after a dozen of tests and reboot's all night.


----------

