help.About the DHCP Wan interface


#1

I have wan interface get address by dhcp
how to set static route in table?
I can not Access to the Internet!!!

ethernet eth1 {
address dhcp
duplex auto
hw-id 00:20:e0:11:03:4e
smp_affinity auto
speed auto
}

protocols {
static {
table 2 {
interface-route 0.0.0.0/0 {
next-hop-interface eth1 {
distance 20
}
}
}

vyos@vyos:~$ sho ip rout table 2
table 2:

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route

S>* 0.0.0.0/0 [20/0] is directly connected, eth1


#2

I think if you have dhcp on Your wan connection the default gateway is set to the one provided by the dhcp server. So you do not need to set a default gateway in Your config.

Do you have correct nat setup?


#3

pretty sure you dont need a static route, you need to configure your masquerade nat for your internal network.


#4

Thanks.
I think,vyos for the fixed address is very effective, but for like DHCP dynamic address is not applicable.
In particular,PolicyBasedRouting and Static Route Table.

I want set some policy route,but the custom route table can not changed.
vtysh -c “conf t” -c “ip route 0.0.0.0/0 x.x.x.x table 10 30”
x.x.x.x get from dhcp gw

How to do it?