EdgeRouter - Configuring Public Static IP Addresses
Overview
Readers will learn how to add static public IP address(es) to an interface on the EdgeRouter.
Table of Contents
- WAN Connection Types
- Configure Static IP Addresses using the Web UI
- Configure Static IP Addresses using the Command Line
- Related Articles
WAN Connection Types
There are different ways in which an Internet Service Provider (ISP) can provide you a public IP address, for example:
-
Static
The ISP provides you an IP range and requires you to manually add your own address(es) and gateway. -
DHCP
The ISP provides you with an automatically assigned address through DHCP. -
PPPoE
The ISP requires you to manually add your own PPPoE interface and authentication credentials.
If your service provider is providing you with a static IP address range, the information may be similar to:
Network Address: 203.0.113.0
Broadcast Address: 203.0.113.7
Subnet Mask: 255.255.255.248
Gateway Address: 203.0.113.6
DNS Servers: 192.0.2.1 - 192.0.2.2
The EdgeRouter requires IP addresses to be written in the CIDR format. This means that the ISP provided subnet mask (255.255.255.248) needs to be converted to a routing prefix. An easy way to convert from subnet masks to CIDR prefixes is to use an IPv4 subnet calculator.
|
|
In this example the prefix will be /29 and the available IP addresses that we can add to the EdgeRouter are 203.0.113.1 - 203.0.113.5.
Configure Static IP Addresses using the Web UI
1. Navigate to the Dashboard tab and assign the IP address(es) to the WAN interface.
Dashboard > Eth0 > Actions > Config
Address: Manually define IP address
IP: 203.0.113.1/29
+ Add IP
Address: Manually define IP address
IP: 203.0.113.2/29
IP: 203.0.113.3/29
IP: 203.0.113.4/29
IP: 203.0.113.5/29
2. Navigate to the System tab in the bottom-left of the web UI to add the default gateway and DNS servers.
System > Name Server
System name server: 192.0.2.1
+ Add New
System name server: 192.0.2.2
System > Gateway
System gateway address: 203.0.113.6
Configure Static IP Addresses using the Command Line
1. Enter configuration mode.
configure
2. Delete the existing IP address configuration from the WAN interface.
delete interfaces ethernet eth0 address
3.Assign the IP address(es) to the WAN interface.
set interfaces ethernet eth0 address 203.0.113.1/29
set interfaces ethernet eth0 address 203.0.113.2/29
set interfaces ethernet eth0 address 203.0.113.3/29
set interfaces ethernet eth0 address 203.0.113.4/29
set interfaces ethernet eth0 address 203.0.113.5/29
4. Add the default gateway address.
set system gateway-address 203.0.113.6
set protocols static route 0.0.0.0/0 next-hop <gateway-address>
command.5. Add the DNS servers.
set system name-server 192.0.2.1
set system name-server 192.0.2.2
6. Commit the changes and save the configuration.
commit ; save
Related Articles
EdgeRouter - How to Create a WAN Firewall Rule