
Router configuration file (used when the router performs Layer.ip address 200.0.0.2 255.255.255.0Ĭonfigure an IP address 192.168.1.2/24 and a gateway addressġ92.168.1.1 for PC1, and configure an IP address 192.168.2.2/24 andĢ00.0.0.1/24 and a gateway address 200.0.0.2 for external network.Īfter the configurations are complete, PC1 and PC2 can ping theĮxternal network IP address 200.0.0.1/24 and access the Internet. ip address 192.168.2.1 24 //Configure the IP address of VLANIF3 as the gateway address of PC2. ip address 192.168.1.1 24 //Configure the IP address of VLANIF2 as the gateway address of PC1. If it has worked in Layer 2 mode, skip this step. portswitch //Change the Ethernet interface from Layer 3 mode to Layer 2 mode. nat outbound 2001Ĭonfigure VLANIF interfaces on the router to implement Layer rule 5 permit source 192.168.0.0 0.0.255.255 //NAT takes effect only for source IP addresses on the network segment 192.168.0.0/16 and translates only source IP addresses of outgoing packets on GE0/0/2. # Configure the NAT function to enable intranet users ip route-static 0.0.0.0 0.0.0.0 200.0.0.1 //Configure a static default route with the next hop pointing to the public IP address 200.0.0.1. # Configure a public network interface IP address andĪ static route. In practice, the DNS-list address needs to be configured based on the DNS assigned to a carrier. dhcp server dns-list 114.114.114.114 223.5.5.5 //The configured DNS-list 114.114.114.114 is a public DNS server address, which is the same for carriers. dhcp select interface //DHCP uses an interface address pool to assign IP addresses to intranet users. Intranet users and specify the DNS server address. # Configure the DHCP function to assign IP addresses to arp broadcast enable //By default, ARP broadcast on a VLAN tag termination sub-interface is disabled on AR routers in a version earlier than V200R003C01 and enabled in V200R003C01 and later versions. To implement Layer 3 forwarding across network segments. Two methods are available to configure a router: one is toĬonfigure sub-interfaces and the other is to configure VLANIF interfaces.Ĭonfigure the router to terminate VLAN tags through sub-interfaces port trunk allow-pass vlan 2 3 //Configure the interface as a trunk interface to transparently transmit packets from VLAN 2 and VLAN 3. port default vlan 2 //Add the interface to VLAN 2. port link-type access //Set the link type of the interface to access. # Configure the interfaces connected to users.
