# change pref src for route



## SlipKo (Apr 15, 2021)

Hello!

I have VM with FreeBSD 12.2. vtnet0 has grey ip address from 10.0.0.0/8 and lo0 has white ip address from 92.xxx.yyy.0/24. I want to set default gw via vtnet0 with pref src address of lo0. How I can do it?


----------



## SirDice (Apr 15, 2021)

Grey, white? What is that supposed to mean? 



SlipKo said:


> I want to set default gw via vtnet0 with pref src address of lo0.


That's not how TCP/IP works.


----------



## SlipKo (Apr 15, 2021)

SirDice said:


> Grey, white? What is that supposed to mean?
> 
> 
> That's not how TCP/IP works.


Grey addresses from RFC1918. White addesses are routed to Internet.

But in Linux I can set default route with pref src setting: ip r add default via gw src <loopback ip address> and it works correctly.


----------



## tingo (Apr 17, 2021)

The common terminology is "private" (RCFC1918) and "public" (for internet-routable) ip addresses.


----------



## PMc (Apr 17, 2021)

SlipKo said:


> Hello!
> 
> I have VM with FreeBSD 12.2. vtnet0 has grey ip address from 10.0.0.0/8 and lo0 has white ip address from 92.xxx.yyy.0/24. I want to set default gw via vtnet0 with pref src address of lo0. How I can do it?


With NAT. I am doing some similar things with NAT and with `ipfw fwd`.


----------

