qemu模拟的JunOS实现路由协议!
经过今天的测试,static,rip,ospf,isis,iBGP,eBGP都没有任何问题。
献给比我还菜的菜鸟。呵呵。老鸟就不用浪费您的时间了。
下面把配置的东西贴一下:
==========STATIC============= root@netDorker# show version 7.4R1.7; system { host-name netDorker; syslog { user * { any emergency; } file messages { any notice; authorization info; } file interactive-commands { interactive-commands any; } } } logical-routers { r1 { interfaces { fxp1 { unit 11 { vlan-id 11; family inet { address 133.10.12.1/24; } } } lo0 { unit 1 { family inet { address 133.10.1.1/32; } } } } routing-options { static { route 0.0.0.0/0 next-hop 133.10.12.2; } } } r2 { interfaces { fxp2 { unit 11 { vlan-id 11; family inet { address 133.10.12.2/24; } } } lo0 { unit 2 { family inet { address 133.10.2.2/32; } } } } routing-options { static { route 0.0.0.0/0 next-hop 133.10.12.1; } } } } interfaces { fxp0 { unit 0 { family inet { address 192.168.0.116/24; } } } fxp1 { vlan-tagging; } fxp2 { vlan-tagging; } fxp3 { vlan-tagging; } }
[edit] root@netDorker#
验证: root@netDorker# run show route logical-router r1
inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 00:02:15 > to 133.10.12.2 via fxp1.11 133.10.1.1/32 *[Direct/0] 00:05:31 > via lo0.1 133.10.12.0/24 *[Direct/0] 00:05:32 > via fxp1.11 133.10.12.1/32 *[Local/0] 00:05:32 Local via fxp1.11
[edit] root@netDorker# run show route logical-router r2
inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 00:02:43 > to 133.10.12.1 via fxp2.11 133.10.2.2/32 *[Direct/0] 00:05:59 > via lo0.2 133.10.12.0/24 *[Direct/0] 00:05:59 > via fxp2.11 133.10.12.2/32 *[Local/0] 00:05:59 Local via fxp2.11
[edit] root@netDorker# run ping 133.10.2.2 source 133.10.1.1 logical-router r1 PING 133.10.2.2 (133.10.2.2): 56 data bytes 64 bytes from 133.10.2.2: icmp_seq=0 ttl=64 time=1.654 ms 64 bytes from 133.10.2.2: icmp_seq=1 ttl=64 time=1.168 ms ^C --- 133.10.2.2 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/stddev = 1.168/1.411/1.654/0.243 ms
[edit] root@netDorker# run ping 133.10.1.1 source 133.10.2.2 logical-router r2 PING 133.10.1.1 (133.10.1.1): 56 data bytes 64 bytes from 133.10.1.1: icmp_seq=0 ttl=64 time=4.330 ms 64 bytes from 133.10.1.1: icmp_seq=1 ttl=64 time=2.129 ms ^C --- 133.10.1.1 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/stddev = 2.129/3.229/4.330/1.101 ms
[edit] root@netDorker# ================================================================= 结论: 简单的静态路由,配置成功。哈哈
===================================== ===================================== rip ==== root@netDorker# show logical-routers r1 interfaces { fxp1 { unit 11 { vlan-id 11; family inet { address 133.10.12.1/24; } } } lo0 { unit 1 { family inet { address 133.10.1.1/32; } } } } protocols { rip { group test-rip { export to-rip; neighbor fxp1.11; } } } policy-options { policy-statement to-rip { term 1 { from protocol [ rip direct ]; then accept; } } } routing-options { router-id 133.10.1.1; autonomous-system 65001; }
[edit] root@netDorker# show logical-routers r2 interfaces { fxp2 { unit 11 { vlan-id 11; family inet { address 133.10.12.2/24; } } } lo0 { unit 2 { family inet { address 133.10.2.2/32; } } } } protocols { rip { group test-rip { export to-rip; neighbor fxp2.11; } } } policy-options { policy-statement to-rip { term 1 { from protocol [ rip direct ]; then accept; } } } routing-options { router-id 133.10.2.2; autonomous-system 65002; }
[edit] ====================== 验证: root@netDorker# run show rip neighbor logical-router r1 Source Destination Send Receive In Neighbor State Address Address Mode Mode Met -------- ----- ------- ----------- ---- ------- --- fxp1.11 Up 133.10.12.1 224.0.0.9 mcast both 1
[edit] root@netDorker# run show rip neighbor logical-router r2 Source Destination Send Receive In Neighbor State Address Address Mode Mode Met -------- ----- ------- ----------- ---- ------- --- fxp2.11 Up 133.10.12.2 224.0.0.9 mcast both 1
[edit] root@netDorker# run show rip statistics logical-router r1 RIPv2 info: port 520; update interval 30s; holddown 180s; timeout 120s. rts learned rts held down rqsts dropped resps dropped 1 0 0 0
fxp1.11: 1 routes learned; 1 routes advertised Counter Total Last 5 min Last minute ------- ----------- ----------- ----------- Updates Sent 10 9 2 Triggered Updates Sent 0 0 0 Responses Sent 0 0 0 Bad Messages 1 0 0 RIPv1 Updates Received 0 0 0 RIPv1 Bad Route Entries 0 0 0 RIPv1 Updates Ignored 0 0 0 RIPv2 Updates Received 4 3 2 RIPv2 Bad Route Entries 0 0 0 RIPv2 Updates Ignored 0 0 0 Authentication Failures 0 0 0 RIP Requests Received 0 0 0 RIP Requests Ignored 0 0 0
[edit] root@netDorker# run show rip statistics logical-router r2 RIPv2 info: port 520; update interval 30s; holddown 180s; timeout 120s. rts learned rts held down rqsts dropped resps dropped 1 0 0 0
fxp2.11: 1 routes learned; 1 routes advertised Counter Total Last 5 min Last minute ------- ----------- ----------- ----------- Updates Sent 3 2 2 Triggered Updates Sent 1 1 0 Responses Sent 0 0 0 Bad Messages 1 0 0 RIPv1 Updates Received 0 0 0 RIPv1 Bad Route Entries 0 0 0 RIPv1 Updates Ignored 0 0 0 RIPv2 Updates Received 10 9 2 RIPv2 Bad Route Entries 0 0 0 RIPv2 Updates Ignored 0 0 0 Authentication Failures 0 0 0 RIP Requests Received 0 0 0 RIP Requests Ignored 0 0 0
[edit] root@netDorker# run show route logical-router r1
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[Direct/0] 00:59:02 > via lo0.1 133.10.2.2/32 *[RIP/100] 00:01:48, metric 2, tag 0 > to 133.10.12.2 via fxp1.11 133.10.12.0/24 *[Direct/0] 00:59:03 > via fxp1.11 133.10.12.1/32 *[Local/0] 00:59:03 Local via fxp1.11 224.0.0.9/32 *[RIP/100] 00:01:07, metric 1 MultiRecv
[edit] root@netDorker# run show route 133.10.2.2 logical-router r1 detail
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) 133.10.2.2/32 (1 entry, 1 announced) *RIP Preference: 100 Next-hop reference count: 6 Next hop: 133.10.12.2 via fxp1.11, selected State: <Active Int> Local AS: 65001 Age: 2:01 Metric: 2 Tag: 0 Task: RIPv2 Announcement bits (1): 2-KRT AS path: I Route learned from 133.10.12.2 expires in 107 seconds
[edit] root@netDorker# run show route logical-router r2
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[RIP/100] 00:05:10, metric 2, tag 0 > to 133.10.12.1 via fxp2.11 133.10.2.2/32 *[Direct/0] 00:59:23 > via lo0.2 133.10.12.0/24 *[Direct/0] 00:59:23 > via fxp2.11 133.10.12.2/32 *[Local/0] 00:59:23 Local via fxp2.11 224.0.0.9/32 *[RIP/100] 00:01:28, metric 1 MultiRecv
[edit] root@netDorker# run ping 133.10.2.2 source 133.10.1.1 logical-router r1 PING 133.10.2.2 (133.10.2.2): 56 data bytes 64 bytes from 133.10.2.2: icmp_seq=0 ttl=64 time=9.814 ms 64 bytes from 133.10.2.2: icmp_seq=1 ttl=64 time=1.640 ms ^C --- 133.10.2.2 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/stddev = 1.640/5.727/9.814/4.087 ms
[edit] ========================== 结论: RIP也没有问题哈。哈哈 ================================= ================================= ospf ===== root@netDorker# show logical-routers r1 interfaces { fxp1 { unit 11 { vlan-id 11; family inet { address 133.10.12.1/24; } } } lo0 { unit 1 { family inet { address 133.10.1.1/32; } } } } protocols { ospf { area 0.0.0.0 { interface fxp1.11; interface lo0.1; } } }
[edit] root@netDorker# show logical-routers r2 interfaces { fxp2 { unit 11 { vlan-id 11; family inet { address 133.10.12.2/24; } } } lo0 { unit 2 { family inet { address 133.10.2.2/32; } } } } protocols { ospf { area 0.0.0.0 { interface fxp2.11; interface lo0.2; } } } =============================== 验证: root@netDorker#
[edit] root@netDorker# run show ospf neighbor logical-router r1 Address Interface State ID Pri Dead 133.10.12.2 fxp1.11 Full 133.10.2.2 128 35
[edit] root@netDorker# run show ospf neighbor logical-router r2 Address Interface State ID Pri Dead 133.10.12.1 fxp2.11 Full 133.10.1.1 128 38
[edit] root@netDorker# run show route table inet.0 logical-router r1
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[Direct/0] 00:20:16 > via lo0.1 133.10.2.2/32 *[OSPF/10] 00:01:43, metric 1 > to 133.10.12.2 via fxp1.11 133.10.12.0/24 *[Direct/0] 00:20:17 > via fxp1.11 133.10.12.1/32 *[Local/0] 00:20:17 Local via fxp1.11 224.0.0.5/32 *[OSPF/10] 00:02:34, metric 1 MultiRecv
[edit] root@netDorker# run show route logical-router r1
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[Direct/0] 00:20:22 > via lo0.1 133.10.2.2/32 *[OSPF/10] 00:01:49, metric 1 > to 133.10.12.2 via fxp1.11 133.10.12.0/24 *[Direct/0] 00:20:23 > via fxp1.11 133.10.12.1/32 *[Local/0] 00:20:23 Local via fxp1.11 224.0.0.5/32 *[OSPF/10] 00:02:40, metric 1 MultiRecv
[edit] root@netDorker# run show route logical-router r2
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[OSPF/10] 00:01:56, metric 1 > to 133.10.12.1 via fxp2.11 133.10.2.2/32 *[Direct/0] 00:20:29 > via lo0.2 133.10.12.0/24 *[Direct/0] 00:20:29 > via fxp2.11 133.10.12.2/32 *[Local/0] 00:20:29 Local via fxp2.11 224.0.0.5/32 *[OSPF/10] 00:02:47, metric 1 MultiRecv
[edit] root@netDorker# run ping 133.10.2.2 source 133.10.1.1 logical-router r1 PING 133.10.2.2 (133.10.2.2): 56 data bytes 64 bytes from 133.10.2.2: icmp_seq=0 ttl=64 time=5.605 ms 64 bytes from 133.10.2.2: icmp_seq=1 ttl=64 time=4.051 ms 64 bytes from 133.10.2.2: icmp_seq=2 ttl=64 time=2.222 ms ^C --- 133.10.2.2 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max/stddev = 2.222/3.959/5.605/1.383 ms
[edit] root@netDorker# ============================================================== 结果: OSPF单区域配置,OK。
======================================= ======================================= ISIS ===== root@netDorker# show logical-routers r1 interfaces { fxp1 { unit 11 { vlan-id 11; family inet { address 133.10.12.1/24; } family iso; } } lo0 { unit 1 { family inet { address 133.10.1.1/32; } family iso { address 47.0000.0000.0000.0001.00; } } } } protocols { isis { interface fxp1.11; interface lo0.1; } }
[edit] root@netDorker# show logical-routers r2 interfaces { fxp2 { unit 11 { vlan-id 11; family inet { address 133.10.12.2/24; } family iso; } } lo0 { unit 2 { family inet { address 133.10.2.2/32; } family iso { address 47.0000.0000.0000.0002.00; } } } } protocols { isis { interface fxp2.11; interface lo0.2; } }
[edit] =================================== 验证: root@netDorker# run show route logical-router r1
inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[Direct/0] 00:27:58 > via lo0.1 133.10.2.2/32 *[IS-IS/15] 00:03:38, metric 10 > to 133.10.12.2 via fxp1.11 133.10.12.0/24 *[Direct/0] 00:27:59 > via fxp1.11 133.10.12.1/32 *[Local/0] 00:27:59 Local via fxp1.11
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
47.0000.0000.0000.0001/72 *[Direct/0] 00:03:50 > via lo0.1
[edit] root@netDorker# run show route logical-router r2
inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
133.10.1.1/32 *[IS-IS/15] 00:03:43, metric 10 > to 133.10.12.1 via fxp2.11 133.10.2.2/32 *[Direct/0] 00:28:03 > via lo0.2 133.10.12.0/24 *[Direct/0] 00:28:03 > via fxp2.11 133.10.12.2/32 *[Local/0] 00:28:03 Local via fxp2.11
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
47.0000.0000.0000.0002/72 *[Direct/0] 00:03:55 > via lo0.2
[edit] root@netDorker# run show isis adjacency logical-router r1 Interface System L State Hold (secs) SNPA fxp1.11 0000.0000.0002 2 Up 7 0:aa:0:0:1:2 fxp1.11 0000.0000.0002 1 Up 8 0:aa:0:0:1:2
[edit] root@netDorker# run show isis adjacency logical-router r2 Interface System L State Hold (secs) SNPA fxp2.11 0000.0000.0001 2 Up 26 0:aa:0:0:1:1 fxp2.11 0000.0000.0001 1 Up 26 0:aa:0:0:1:1
[edit] root@netDorker# run ping 133.10.2.2 source 133.10.1.1 logical-router r1 PING 133.10.2.2 (133.10.2.2): 56 data bytes 64 bytes from 133.10.2.2: icmp_seq=0 ttl=64 time=4.640 ms 64 bytes from 133.10.2.2: icmp_seq=1 ttl=64 time=1.362 ms 64 bytes from 133.10.2.2: icmp_seq=2 ttl=64 time=1.149 ms 64 bytes from 133.10.2.2 icmp_seq=3 ttl=64 time=1.517 ms ^C --- 133.10.2.2 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max/stddev = 1.149/2.167/4.640/1.434 ms
[edit] root@netDorker# ============================ 结论: 基本的ISIS配置OK.
=========================================================== =========================================================== iBGP ======= root@netDorker# show logical-routers r1 interfaces { fxp1 { unit 11 { vlan-id 11; family inet { address 133.10.12.1/24; } family iso; } } lo0 { unit 1 { family inet { address 133.10.1.1/32; } family iso { address 47.0000.0000.0000.0001.00; } } } } protocols { bgp { group test-bgp { type internal; local-address 133.10.1.1; neighbor 133.10.2.2; } } isis { interface fxp1.11; interface lo0.1; } } routing-options { router-id 133.10.1.1; autonomous-system 65000; }
[edit] root@netDorker# show logical-routers r2 interfaces { fxp2 { unit 11 { vlan-id 11; family inet { address 133.10.12.2/24; } family iso; } } lo0 { unit 2 { family inet { address 133.10.2.2/32; } family iso { address 47.0000.0000.0000.0002.00; } } } } protocols { bgp { group test-bgp { type internal; local-address 133.10.2.2; neighbor 133.10.1.1; } } isis { interface fxp2.11; interface lo0.2; } } routing-options { router-id 133.10.2.2; autonomous-system 65000; }
[edit] ============================ 验证: root@netDorker# run show bgp neighbor logical-router r1 Peer: 133.10.2.2+1073 AS 65000 Local: 133.10.1.1+179 AS 65000 Type: Internal State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: Cease Options: <Preference LocalAddress HoldTime Refresh> Local Address: 133.10.1.1 Holdtime: 90 Preference: 170 Number of flaps: 0 Error: 'Cease' Sent: 1 Recv: 0 Peer ID: 133.10.2.2 Local ID: 133.10.1.1 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 8 Sent 8 Checked 8 Input messages: Total 3 Updates 0 Refreshes 0 Octets 83 Output messages: Total 4 Updates 0 Refreshes 0 Octets 102 Output Queue[0]: 0
[edit] root@netDorker# run show bgp neighbor logical-router r2 Peer: 133.10.1.1+179 AS 65000 Local: 133.10.2.2+1073 AS 65000 Type: Internal State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference LocalAddress HoldTime Refresh> Local Address: 133.10.2.2 Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 133.10.1.1 Local ID: 133.10.2.2 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 16 Sent 16 Checked 16 Input messages: Total 2 Updates 0 Refreshes 0 Octets 38 Output messages: Total 4 Updates 0 Refreshes 0 Octets 102 Output Queue[0]: 0 [edit] root@netDorker# ====================== 结论: BGP neighbor和cisco一样,最终状态是established。哈哈OK了。
===================================== ===================================== eBGP ========== root@netDorker# show r1 { interfaces { fxp1 { unit 11 { vlan-id 11; family inet { address 133.10.12.1/24; } family iso; } } lo0 { unit 1 { family inet { address 133.10.1.1/32; } family iso { address 47.0000.0000.0000.0001.00; } } } } protocols { bgp { group test-bgp { type external; multihop; local-address 133.10.1.1; local-as 65001; neighbor 133.10.2.2 { peer-as 65002; } } } isis { interface fxp1.11; interface lo0.1; } } routing-options { router-id 133.10.1.1; autonomous-system 65001; } } r2 { interfaces { fxp2 { unit 11 { vlan-id 11; family inet { address 133.10.12.2/24; } family iso; } } lo0 { unit 2 { family inet { address 133.10.2.2/32; } family iso { address 47.0000.0000.0000.0002.00; } } } } protocols { bgp { group test-bgp { type external; multihop; local-address 133.10.2.2; local-as 65002; neighbor 133.10.1.1 { peer-as 65001; } } } isis { interface fxp2.11; interface lo0.2; } } routing-options { router-id 133.10.2.2; autonomous-system 65002; } } rs { protocols { isis { interface lo0.2; } } }
[edit logical-routers] =================================== 验证: root@netDorker# run show bgp neighbor logical-router r1 Peer: 133.10.2.2+2404 AS 65002 Local: 133.10.1.1+179 AS 65001 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Multihop Preference LocalAddress HoldTime PeerAS LocalAS Refresh> Local Address: 133.10.1.1 Holdtime: 90 Preference: 170 Local AS: 65001 Local System AS: 65001 Number of flaps: 0 Peer ID: 133.10.2.2 Local ID: 133.10.1.1 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 29 Sent 29 Checked 29 Input messages: Total 2 Updates 0 Refreshes 0 Octets 64 Output messages: Total 3 Updates 0 Refreshes 0 Octets 83 Output Queue[0]: 0
[edit logical-routers] root@netDorker# run show bgp neighbor logical-router r2 Peer: 133.10.1.1+179 AS 65001 Local: 133.10.2.2+2404 AS 65002 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Multihop Preference LocalAddress HoldTime PeerAS LocalAS Refresh> Local Address: 133.10.2.2 Holdtime: 90 Preference: 170 Local AS: 65002 Local System AS: 65002 Number of flaps: 0 Peer ID: 133.10.1.1 Local ID: 133.10.2.2 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 8 Sent 8 Checked 8 Input messages: Total 2 Updates 0 Refreshes 0 Octets 38 Output messages: Total 4 Updates 0 Refreshes 0 Octets 102 Output Queue[0]: 0
[edit logical-routers] root@netDorker# ============================== 结论: eBGP配置没问题。哈哈,OK. |