PLAYING AROUND WITH VYOS

Configure vyOS as a gateway in the following scenario:

- WAN interface: eth0 (10.0.0.1/8)
- LAN interface:   eth1 (10.10.10.1/24)

It would look like this:
 


set interfaces ethernet eth0 address '10.0.0.1/8'
set interfaces ethernet eth1 address '10.10.10.1/24'

set nat destination rule 9999 description 'forwarding'
set nat destination rule 9999 destination address '10.0.0.1'
set nat destination rule 9999 inbound-interface 'eth0'
set nat destination rule 9999 translation address '10.10.10.1'
  
set nat source rule 9999 description 'forwarding'
set nat source rule 9999 source address '10.10.10.0/24'
set nat source rule 9999 outbound-interface 'eth0'
set nat source rule 9999 translation address '10.0.0.1'

 
Port forwarding (example: forward DNS requests via port 53 UDP to 10.0.2.102:53):
 


conf
set nat destination rule 53 description 'dns'
set nat destination rule 53 destination port '53'
set nat destination rule 53 inbound-interface 'eth0'
set nat destination rule 53 protocol 'udp'
set nat destination rule 53 translation address '10.0.2.102'

 
To apply changes:
 


commit
save
exit