Overview
Take the following topology as an example to introduce how to implement communication between PC1 and PC2.
Figure 1. Topology of Access Network
The data plan is shown as below.
Device | Interface | VLAN and IP Address |
Switch A | te-1/1/1 | VLAN: 10 IP address: 10.10.10.1/24 |
te-1/1/2 | VLAN: 4 IP address: 10.10.4.1/24 | |
te-1/1/3 | VLAN: 5 IP address: 10.10.5.2/24 | |
Switch B | te-1/1/1 | VLAN: 3 IP address: 10.10.3.1/24 |
te-1/1/2 | VLAN: 4 IP address: 10.10.4.2/24 | |
Switch C | te-1/1/1 | VLAN: 2 IP address: 10.10.2.1/24 |
te-1/1/3 | VLAN: 5 IP address: 10.10.5.1/24 | |
PC1 | 10.10.3.8/24 | |
PC2 | 10.10.2.8/24 |
Procedure
Before configuring the following steps, make sure you have logged in the specified switch through Console port or SSH. For detailed information, see Initial Setup and Configuring the SSH Access.
Step1 In the configuration mode, configure the host name of switch respectively as SwitchA, SwitchB and SwitchC.
admin@PICOS> configure admin@PICOS# set system hostname SwitchA admin@PICOS# commit admin@SwitchA#
Run the same command on other switches to change the hostname as SwitchB and SwitchC.
Step2 Configure the interface and VLAN.
Switch A
Interface te-1-1-1:
admin@SwitchA# set vlans vlan-id 10 admin@SwitchA# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 10 admin@SwitchA# set vlans vlan-id 10 l3-interface vlan10 admin@SwitchA# set l3-interface vlan-interface vlan10 address 10.10.10.1 prefix-length 24 admin@SwitchA# commit
Interface te-1-1-2:
admin@SwitchA# set vlans vlan-id 4 admin@SwitchA# set interface gigabit-ethernet te-1/1/2 family ethernet- admin@SwitchA# switching native-vlan-id 4 admin@SwitchA# set vlans vlan-id 4 l3-interface vlan4 admin@SwitchA# set l3-interface vlan-interface vlan4 address 10.10.4.1 prefix-length 24 admin@SwitchA# commit
Interface te-1-1-3:
admin@SwitchA# set vlans vlan-id 5 admin@SwitchA# set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 5 admin@SwitchA# set vlans vlan-id 5 l3-interface vlan5 admin@SwitchA# set l3-interface vlan-interface vlan5 address 10.10.5.2 prefix-length 24 admin@SwitchA# commit
Switch B
Interface te-1-1-1:
admin@SwitchB# set vlans vlan-id 3 admin@SwitchB# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 3 admin@SwitchB# set vlans vlan-id 3 l3-interface vlan3 admin@SwitchB# set l3-interface vlan-interface vlan3 address 10.10.3.1 prefix-length 24 admin@SwitchB# commit
Interface te-1-1-2:
admin@SwitchB# set vlans vlan-id 4 admin@SwitchB# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 4 admin@SwitchB# set vlans vlan-id 4 l3-interface vlan4 admin@SwitchB# set l3-interface vlan-interface vlan4 address 10.10.4.2 prefix-length 24 admin@SwitchB# commit
Switch C
Interface te-1-1-1:
admin@SwitchC# set vlans vlan-id 2 admin@SwitchC# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 2 admin@SwitchC# set vlans vlan-id 2 l3-interface vlan2 admin@SwitchC# set l3-interface vlan-interface vlan2 address 10.10.2.1 prefix-length 24 admin@SwitchC# commit
Interface te-1-1-3:
admin@SwitchC# set vlans vlan-id 5 admin@SwitchC# set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 5 admin@SwitchC# set vlans vlan-id 5 l3-interface vlan5 admin@SwitchC# set l3-interface vlan-interface vlan5 address 10.10.5.1 prefix-length 24 admin@SwitchC# commit
Step3 Configure the IP address and default gateway of PC1 and PC2.
PC1:
root@UbuntuDockerGuest-1:~# ifconfig eth0 10.10.3.8/24 root@UbuntuDockerGuest-1:~# route add default gw 10.10.3.1
PC2:
root@UbuntuDockerGuest-2:~# ifconfig eth0 10.10.2.8/24 root@UbuntuDockerGuest-2:~# route add default gw 10.10.2.1
Step4 Configure the routing. You can configure the static routing or OSPF routing to connect network.
Connecting network through the static routing
Switch A:
admin@SwitchA# set ip routing enable true admin@SwitchA# set protocols static route 10.10.2.0/24 next-hop 10.10.5.1 admin@SwitchA# set protocols static route 10.10.3.0/24 next-hop 10.10.4.2 admin@SwitchA# commit
Switch B:
admin@SwitchB# set ip routing enable true admin@SwitchB# set protocols static route 0.0.0.0/0 next-hop 10.10.4.1 admin@SwitchB# commit
Switch C:
admin@SwitchC# set ip routing enable true admin@SwitchC# set protocols static route 0.0.0.0/0 next-hop 10.10.5.2 admin@SwitchC# commit
Connecting network through the OSPF routing
Switch A:
admin@SwitchA# set l3-interface loopback lo address 1.1.1.1 prefix-length 32 admin@SwitchA# set protocols ospf router-id 1.1.1.1 admin@SwitchA# set protocols ospf network 10.10.4.0/24 area 0 admin@SwitchA# set protocols ospf network 10.10.10.0/24 area 0 admin@SwitchA# set protocols ospf network 10.10.5.0/24 area 1 admin@SwitchA# commit
Switch B:
admin@SwitchB# set l3-interface loopback lo address 2.2.2.2 prefix-length 32 admin@SwitchB# set protocols ospf router-id 2.2.2.2 admin@SwitchB# set protocols ospf network 10.10.4.0/24 area 0 admin@SwitchB# set protocols ospf network 10.10.3.0/24 area 0 admin@SwitchB# commit
Switch C:
admin@SwitchC# set l3-interface loopback lo address 3.3.3.3 prefix-length 32 admin@SwitchC# set protocols ospf router-id 3.3.3.3 admin@SwitchC# set protocols ospf network 10.10.2.0/24 area 1 admin@SwitchC# set protocols ospf network 10.10.5.0/24 area 1 admin@SwitchC# commit
Verifying the Configuration
View the routing table of each switch.
Static Routing:
Figure2. Static Routing Entries of SwitchAFigure3. Static Routing Entries of SwitchB
Figure4. Static Routing Entries of SwitchC
OSPF Routing:
Figure5. OSPF Routing Entries of SwitchAFigure6. OSPF Routing Entries of SwitchB
Figure7. OSPF Routing Entries of SwitchC
Run Ping command to check the connectivity between PC1 and PC2.
PC1 ping PC2:
Figure8. Result of PC1 Ping PC2PC2 ping PC1:
Figure9. Result of PC2 Ping PC1