HOTLINE: 0903.209.123

EdgeRouter - Cách cấu hình giao diện configure an interface
2017-09-23 16:03:53


Readers will learn how to configure a router interface. This is composed of two parts:

  • Assign an IP address and subnet mask
  • Enter a description


Use the setcomparecommit, and save commands.

To configure an interface, use the set command:


ubnt@ubnt:~$ configure

To view the possible completions for the eth0 address, enter set interfaces ethernet eth0 address and press the ? key.


ubnt@ubnt# set interfaces ethernet eth0 address                              
Possible completions:                                                           
 <x.x.x.x/x>   IP address and prefix length                                    
               IPv6 address and prefix length                                  
 dhcp          Dynamic Host Configuration Protocol                             
 dhcpv6        Dynamic Host Configuration Protocol for IPv6                    
ubnt@ubnt# set interfaces ethernet eth0 address                     
ubnt@ubnt# set interfaces ethernet eth0 description "production LAN"            

These changes affect the working configuration, not the active configuration. To see what changes have been made to the working configuration, use the compare command:


ubnt@ubnt# compare                                                              
[edit interfaces ethernet eth0]                                                 
+description "production LAN"                                                   

To make the changes active, use the commit command:


ubnt@ubnt# commit                                                               

If you reboot the EdgeRouter, the changes will be lost. To save these changes, use the save command to save the active configuration to the boot configuration.


ubnt@ubnt# save                                                                 
Saving configuration to '/config/config.boot'...                                
ubnt@ubnt# exit                                                                 
ubnt@ubnt:~$ show interfaces                                                    
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down                    
Interface    IP Address                        S/L  Description                 
---------    ----------                        ---  -----------                 
eth0                      u/u  production LAN              
eth1         -                                 u/D                              
eth2         -                                 u/D                              
eth3         -                                 u/D                              
eth4         -                                 u/D                              
eth5         -                                 u/D                              
eth6         -                                 u/D                              
lo                        u/u                              

ubnt@ubnt:~$ ping                                                      
PING ( 56(84) bytes of data.                                  
64 bytes from icmp_req=1 ttl=64 time=0.460 ms                         
64 bytes from icmp_req=2 ttl=64 time=0.407 ms                         
--- ping statistics ---                                                
2 packets transmitted, 2 received, 0% packet loss, time 999ms                   
rtt min/avg/max/mdev = 0.407/0.433/0.460/0.033 ms