Discussion:
Openbsd 6.9 Default gateway
Irshad Sulaiman
2021-05-07 21:31:29 UTC
Permalink
Hi
How to set only one default gateway if I have multiple interface , one is in DHCP and other in Static ip
I have set /etc/mygate 192.168.100.1 and hostname.em0 (DHCP) and hostname.iwn0 (static 192.168.100.163 255.255.255.0)

But when I sh /etc/netstart it sets multiple gateway with following
Internet:

Destination Gateway Flags Refs Use Mtu Prio Iface
default 192.168.1.1 UGS 0 37 - 8 em0
default 192.168.100.1 UGS 0 0 - 12 iwn0

Only iwn0 have internet and I cannot connect to internet

How to set hostname.iwn0 as default gateway

With multiple default gateway I cannot ping outside


Appreciate
l***@mailbox.org
2021-05-07 23:28:08 UTC
Permalink
Post by Irshad Sulaiman
How to set hostname.iwn0 as default gateway
Probably there is a better solution. Maybe someone with more
knowledge of netstart can help. I'd try my luck with pf and create
a natting rule to check for traffic leaving em0 that's not - for
example - 192.168.1.0/24:

pass out on em0 from $int_net to ! $int_net received-on em0 nat-to iwn0

Didn't have the time to check this rule though.
Irshad Sulaiman
2021-05-07 23:37:41 UTC
Permalink
Thank you for the reply


I could do by
Delete and adding route with route command manually
But is there any better way to do this
Post by l***@mailbox.org
Post by Irshad Sulaiman
How to set hostname.iwn0 as default gateway
Probably there is a better solution. Maybe someone with more
knowledge of netstart can help. I'd try my luck with pf and create
a natting rule to check for traffic leaving em0 that's not - for
pass out on em0 from $int_net to ! $int_net received-on em0 nat-to iwn0
Didn't have the time to check this rule though.
Daniel Jakots
2021-05-08 02:08:49 UTC
Permalink
On Sat, 8 May 2021 02:37:41 +0300, Irshad Sulaiman
Post by Irshad Sulaiman
Thank you for the reply
I could do by
Delete and adding route with route command manually
But is there any better way to do this
If you used the same network both on wired and wireless, you could use
a trunk(4) in failover mode for a transparent transition. Check
"Trunking Your Wireless Adapter" in
https://www.openbsd.org/faq/faq6.html

Cheers,
Daniel
Irshad Sulaiman
2021-05-08 02:13:38 UTC
Permalink
Both in different Network , Just added route to hostname.if with -priority lower than other interface , it worked
Thank you
Post by Daniel Jakots
On Sat, 8 May 2021 02:37:41 +0300, Irshad Sulaiman
Post by Irshad Sulaiman
Thank you for the reply
I could do by
Delete and adding route with route command manually
But is there any better way to do this
If you used the same network both on wired and wireless, you could use
a trunk(4) in failover mode for a transparent transition. Check
"Trunking Your Wireless Adapter" in
https://www.openbsd.org/faq/faq6.html
Cheers,
Daniel
Stuart Henderson
2021-05-08 08:54:54 UTC
Permalink
Post by Irshad Sulaiman
Hi
How to set only one default gateway if I have multiple interface , one is in DHCP and other in Static ip
I have set /etc/mygate 192.168.100.1 and hostname.em0 (DHCP) and hostname.iwn0 (static 192.168.100.163 255.255.255.0)
Sounds like you want to request an address by DHCP, but ignore the gateway
handed out by the DHCP server; "ignore routers;" in dhclient.conf should
do the trick.
Irshad Sulaiman
2021-05-08 09:57:14 UTC
Permalink
Thank you
You are right

Irshad
Post by Stuart Henderson
Post by Irshad Sulaiman
Hi
How to set only one default gateway if I have multiple interface , one is in DHCP and other in Static ip
I have set /etc/mygate 192.168.100.1 and hostname.em0 (DHCP) and hostname.iwn0 (static 192.168.100.163 255.255.255.0)
Sounds like you want to request an address by DHCP, but ignore the gateway
handed out by the DHCP server; "ignore routers;" in dhclient.conf should
do the trick.
Loading...