Router - VyOS: Difference between revisions
Appearance
Content deleted Content added
Added configuration commands for PPPoE |
Added LAN configuration commands and NAT |
||
| Line 24: | Line 24: | ||
== Configuring |
== Configuring LAN Interface == |
||
This section describes how to configure the LAN interface (eth0) with an IP address and advertise addresses using SLAAC and DHCP. |
|||
TBC |
|||
First configure addresses on the interface. |
|||
| ⚫ | |||
We are going to use the first /64 subnet of your IPv6 allocation for the LAN subnet. |
|||
<code>xxxx</code> needs to be replaced with your AAISP IPv6 allocation. |
|||
<pre> |
|||
| ⚫ | |||
| ⚫ | |||
set interface ethernet eth0 address 192.168.1.1/24 |
|||
set interface ethernet eth0 address 2001:8b0:xxxx::1/64 |
|||
</pre> |
|||
To configure SLAAC / IPv6 router advertisements enter the following two commands: |
|||
| ⚫ | |||
<pre> |
|||
| ⚫ | |||
set interface ethernet eth0 ipv6 router-advert send-advert true |
|||
| ⚫ | |||
set interface ethernet eth0 ipv6 router-advert prefix 2001:8b0:xxxx::/64 |
|||
</pre> |
|||
Then to configure a DHCP server on the LAN interface: |
|||
<pre> |
<pre> |
||
set service dhcp-server shared-network-name LAN authoritative |
|||
| ⚫ | |||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 default-router '192.168.1.1' |
|||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 dns-server '217.169.20.20' |
|||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 dns-server '217.169.20.21' |
|||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 domain-name 'example.com' |
|||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 lease '86400' |
|||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 range 0 start '192.168.1.10' |
|||
set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 range 0 stop '192.168.1.250' |
|||
</pre> |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
<pre> |
|||
set interface ethernet eth1 description "WAN" |
|||
set interface ethernet eth1 pppoe 0 user-id mxxxx@a.1 |
set interface ethernet eth1 pppoe 0 user-id mxxxx@a.1 |
||
set interface ethernet eth1 pppoe 0 password xxxx |
set interface ethernet eth1 pppoe 0 password xxxx |
||
| Line 46: | Line 73: | ||
set interface ethernet eth1 pppoe 0 enable-ipv6 |
set interface ethernet eth1 pppoe 0 enable-ipv6 |
||
set interface ethernet eth1 pppoe 0 ipv6 address autoconf |
set interface ethernet eth1 pppoe 0 ipv6 address autoconf |
||
</pre> |
|||
| ⚫ | |||
<pre> |
|||
set protocols static interface-route6 ::/0 next-hop-interface pppoe0 |
set protocols static interface-route6 ::/0 next-hop-interface pppoe0 |
||
</pre> |
</pre> |
||
| ⚫ | |||
Finally setup NAT, so that the private IPv4 addresses on the LAN interface can access the internet: |
|||
<pre> |
|||
set nat source rule 100 description "NAT for IPv4 on LAN" |
|||
set nat source rule 100 outbound-interface 'pppoe0' |
|||
set nat source rule 100 source address '192.168.1.0/24' |
|||
set nat source rule 100 translation address masquerade |
|||
</pre> |
|||
| ⚫ | |||
* The first network interface (eth0) is connected to the local LAN |
* The first network interface (eth0) is connected to the local LAN |
||
| Line 126: | Line 168: | ||
lease 86400 |
lease 86400 |
||
range 0 { |
range 0 { |
||
start 192.168.1. |
start 192.168.1.10 |
||
stop 192.168.1. |
stop 192.168.1.250 |
||
} |
} |
||
} |
} |
||