[FREENAS-Networking] No internet access

hackman61

Cadet
Joined
May 12, 2012
Messages
3
Hello everybody,

I have an ESXI physical host, online at OVH (a server provider in France), OVH gives me an public IP for managing my esxi (37.59.42.XX), and gives me 3 fail-over IP, wich can be routed on my physical public IP address. One of these IP is designed by a virtual mac adress for a freenas VM. But the configuration of network is strange :

I must enter in freenas configuration : @ip : 87.98.144.XX/32 , and as default route : 37.59.42.254 BUT with this configuration ( wich is working on an other vm) i can't have wan access...

in ubuntu i have a /etc/network/interface like that :


# WAN
auto eth1
allow-hotplug eth1
iface eth1 inet static
address 188.165.51.***
netmask 255.255.255.255
broadcast 188.165.51.***
post-up route add 37.59.42.254 dev eth1
post-up route add default gw 37.59.42.254
post-down route del 37.59.42.254 dev eth1
post-down del default gw 37.59.42.254

And it works!!

Have you any idea? Thanks a lot!



PS : Sorry for my bad english, i'm french :)
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Ubuntu????

FreeNAS is based on FreeBSD, not Ubuntu.

What version of FreeNAS are you using?
 

hackman61

Cadet
Joined
May 12, 2012
Messages
3
Yes I know that FREEnas is based on FREEbsd ;), but i would just said that the configuration for an other vm, based on ubuntu was working to access internet.

I use the 8.0-4 (latest ) version of freenas.
 
Joined
Sep 6, 2012
Messages
5
Just as I said in the French version of this post, a way to obtain the desired result is to use the following commands on a command line:

route add -host 37.59.42.254 -iface re0
route add default 37.59.42.254

The actual issue is how does one make this a persistent change? I could find no way to change the routing configuration in a persistent way using CLI, and the Web UI does not allow "-iface re0" as a valid value for the gateway when creating the static route.

This is a real issue. In my case, right now, I would like to allocate more disk space to my FreeNAS VM, but this would require rebooting it. And since I can not use the Proxmox console emulator from where I am now to reestablish network connectivity after booting (network restrictions), I am stuck.
 
Joined
Sep 6, 2012
Messages
5
OK. Found a solution, inspired by other unrelated posts. This is a dirty hack but...

* Open a console to the VM
* Make the root filesystem writeable : mount -uw /
* Edit the rc.conf.local template : vi /conf/base/etc/rc.conf.local
* Add the following line at the end (I added them before the last line) :

static_routes="togateway default"
route_togateway="-host 37.59.42.254 -iface re0"
route_default="default 37.59.42.254"

* Reboot

Please note that using the "defaultrouter" directive in rc.conf.local wouldn't work because it is applied BEFORE the route_* ones, and so it fails in our case. That would be trying to use a default gateway that the VM does not yet know how to reach.

Obviously, none of these modifications will register in the Web UI. Dirty, but it works.

EDIT: fixed a typo in the last command.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
It may be dirty, but that's exactly how I would do it.
 
Joined
Sep 6, 2012
Messages
5
Just found a typo in my post... The lines to add to rc.conf.local are:
static_routes="togateway default"
route_togateway="-host 37.59.42.254 -iface re0"
route_default="default 37.59.42.254"
 

carlosepc

Cadet
Joined
Jun 4, 2020
Messages
6
Any solution on this for the new Freeenas Version I am adding this settings and when restart Freenas remove and put new files.
 
Top