Это все странно, в общем у меня есть 3 железки и пару серверов, я перенес схему на реальное железо и получил тот же самый эффект.
Первое прикладываю нормальную схему топологии сети.
Конфиги такие, SW1
- Код: Выделить всё
# show protocols bgp
group downlinks {
neighbor 192.168.20.2 {
local-address 192.168.20.1;
hold-time 20;
import bgp_import_from_192.168.20.2;
export bgp_export_to_192.168.20.2;
peer-as 64515;
}
}
- Код: Выделить всё
# show policy-options policy-statement bgp_import_from_192.168.20.2
term 100 {
from protocol bgp;
then accept;
}
term default {
then reject;
}
- Код: Выделить всё
# show policy-options policy-statement bgp_export_to_192.168.20.2
term 200 {
from {
route-filter 0.0.0.0/0 exact;
}
then reject;
}
term 100 {
from protocol [ direct static ];
then accept;
}
term default {
then reject;
}
- Код: Выделить всё
# show interfaces ge-0/0/2
unit 0 {
family inet {
address 192.168.101.254/24;
}
}
- Код: Выделить всё
# run show route
inet.0: 9 destinations, 11 routes (9 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[BGP/170] 00:37:45, localpref 100
AS path: 64515 I, validation-state: unverified
> to 192.168.20.2 via ae0.0
192.168.20.0/30 *[Direct/0] 15:11:51
> via ae0.0
[BGP/170] 00:55:21, localpref 100
AS path: 64515 I, validation-state: unverified
> to 192.168.20.2 via ae0.0
192.168.20.1/32 *[Local/0] 15:11:51
Local via ae0.0
192.168.20.4/30 *[BGP/170] 00:55:21, localpref 100
AS path: 64515 I, validation-state: unverified
> to 192.168.20.2 via ae0.0
192.168.101.0/24 *[Direct/0] 14:54:03
> via ge-0/0/2.0
192.168.101.254/32 *[Local/0] 14:54:18
Local via ge-0/0/2.0
192.168.201.0/24 *[BGP/170] 00:55:21, localpref 100
AS path: 64515 I, validation-state: unverified
> to 192.168.20.2 via ae0.0
CORE: M10i- Код: Выделить всё
run show version
Hostname: M10I
Model: m10i
JUNOS Base OS boot [12.3R6.6]
JUNOS Base OS Software Suite [12.3R6.6]
JUNOS Kernel Software Suite [12.3R6.6]
JUNOS Crypto Software Suite [12.3R6.6]
JUNOS Packet Forwarding Engine Support (M/T/EX Common) [12.3R6.6]
JUNOS Packet Forwarding Engine Support (M7i/M10i) [12.3R6.6]
JUNOS Online Documentation [12.3R6.6]
JUNOS Services AACL Container package [12.3R6.6]
JUNOS Services Application Level Gateways [12.3R6.6]
JUNOS AppId Services [12.3R6.6]
JUNOS Border Gateway Function package [12.3R6.6]
JUNOS Services Captive Portal and Content Delivery Container package [12.3R6.6]
JUNOS Services HTTP Content Management package [12.3R6.6]
JUNOS IDP Services [12.3R6.6]
JUNOS Services LL-PDF Container package [12.3R6.6]
JUNOS Services NAT [12.3R6.6]
JUNOS Services PTSP Container package [12.3R6.6]
JUNOS Services RPM [12.3R6.6]
JUNOS Services Stateful Firewall [12.3R6.6]
JUNOS Voice Services Container package [12.3R6.6]
JUNOS Services Example Container package [12.3R6.6]
JUNOS Services Crypto [12.3R6.6]
JUNOS Services SSL [12.3R6.6]
JUNOS Services IPSec [12.3R6.6]
JUNOS Runtime Software Suite [12.3R6.6]
JUNOS platform Software Suite [12.3R6.6]
JUNOS Routing Software Suite [12.3R6.6]
- Код: Выделить всё
show protocols bgp
group uplinks {
neighbor 192.168.20.1 {
local-address 192.168.20.2;
hold-time 20;
import bgp_import_from_192.168.20.1;
export bgp_export_to_192.168.20.1;
peer-as 64513;
}
}
- Код: Выделить всё
show routing-options
interface-routes {
rib-group inet fbf-group;
}
static {
route 0.0.0.0/0 {
discard;
no-install;
}
}
rib-groups {
fbf-group {
import-rib [ inet.0 sp1-route-table.inet.0 ];
}
}
router-id 192.168.20.2;
autonomous-system 64515;
- Код: Выделить всё
show routing-instances
sp1-route-table {
instance-type forwarding;
routing-options {
static {
route 0.0.0.0/0 next-hop 192.168.20.5;
}
}
}
- Код: Выделить всё
show protocols ospf
export ospf-export-to-area0;
area 0.0.0.0 {
interface ge-0/0/2.0;
}
- Код: Выделить всё
root@M10I# run show route
inet.0: 11 destinations, 13 routes (11 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 00:40:02
Discard
192.168.20.0/30 *[Direct/0] 15:15:00
> via ae0.0
[BGP/170] 00:57:38, localpref 100
AS path: 64513 I, validation-state: unverified
> to 192.168.20.1 via ae0.0
192.168.20.2/32 *[Local/0] 15:15:03
Local via ae0.0
192.168.20.4/30 *[Direct/0] 01:11:12
> via ge-0/0/2.0
192.168.20.6/32 *[Local/0] 01:14:37
Local via ge-0/0/2.0
192.168.101.0/24 *[BGP/170] 00:57:38, localpref 100
AS path: 64513 I, validation-state: unverified
> to 192.168.20.1 via ae0.0
192.168.201.0/24 *[Direct/0] 01:06:25
> via ge-0/0/3.0
192.168.201.254/32 *[Local/0] 01:06:25
Local via ge-0/0/3.0
224.0.0.5/32 *[OSPF/10] 6d 01:10:15, metric 1
MultiRecv
sp1-route-table.inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 00:14:54
> to 192.168.20.5 via ge-0/0/2.0
192.168.20.0/30 *[Direct/0] 00:14:54
> via ae0.0
192.168.20.2/32 *[Local/0] 00:14:54
Local via ae0.0
192.168.20.4/30 *[Direct/0] 00:14:54
> via ge-0/0/2.0
192.168.20.6/32 *[Local/0] 00:14:54
Local via ge-0/0/2.0
192.168.201.0/24 *[Direct/0] 00:14:54
> via ge-0/0/3.0
192.168.201.254/32 *[Local/0] 00:14:54
Local via ge-0/0/3.0
- Код: Выделить всё
root@M10I# show firewall
filter classify-customers {
term sp1-customers {
from {
source-address {
192.168.201.1/32;
}
}
then {
log;
routing-instance sp1-route-table;
}
}
term default {
then accept;
}
}
filter classify-customers-WAN {
term sp1-customers {
from {
source-address {
192.168.101.1/32;
}
}
then {
log;
routing-instance sp1-route-table;
}
}
term default {
then accept;
}
}
SW2, на нем только OSPF, поднятый между ним и M10i
# run show route
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[OSPF/150] 00:41:32, metric 0, tag 0
> to 192.168.20.6 via ge-0/0/2.0
192.168.20.4/30 *[Direct/0] 01:11:26
> via ge-0/0/2.0
192.168.20.5/32 *[Local/0] 01:11:26
Local via ge-0/0/2.0
224.0.0.5/32 *[OSPF/10] 00:51:03, metric 1
MultiRecv
Ок, теперь трасируем с 192.168.201.1 адрес: 192.168.101.1:
- Код: Выделить всё
root@test2:~# traceroute 192.168.101.1
traceroute to 192.168.101.1 (192.168.101.1), 30 hops max, 60 byte packets
1 192.168.201.254 (192.168.201.254) 0.174 ms 0.148 ms 0.194 ms
2 192.168.20.1 (192.168.20.1) 1.374 ms 1.454 ms 1.479 ms
3 192.168.101.1 (192.168.101.1) 0.152 ms 0.178 ms 0.162 ms
включаем на M10i правило перенаправления пакетов:
- Код: Выделить всё
set interfaces ge-0/0/3 unit 0 family inet filter input classify-customers
смотрим результат:
- Код: Выделить всё
# traceroute 192.168.101.1
traceroute to 192.168.101.1 (192.168.101.1), 30 hops max, 60 byte packets
1 192.168.201.254 (192.168.201.254) 0.221 ms 0.219 ms 0.300 ms
2 192.168.20.5 (192.168.20.5) 1.871 ms 1.959 ms 1.989 ms
3 192.168.20.6 (192.168.20.6) 0.259 ms 0.309 ms 0.290 ms
4 192.168.20.1 (192.168.20.1) 1.188 ms 1.280 ms 1.306 ms
5 192.168.101.1 (192.168.101.1) 0.238 ms 0.222 ms 0.202 ms
Все работает как часы, то есть для исходящего из нашей сети трафика мы можем менять маршрут направления, но нам надо перенаправить входящий трафик, так что:
deactivate interfaces ge-0/0/3 unit 0 family inet filter input
set interfaces ae0 unit 0 family inet filter input classify-customers-WAN
и смотрим результат:
root@M10I# run clear firewall log
с тестового сервера:
- Код: Выделить всё
root@t1:~# ping -c 1 192.168.201.1
PING 192.168.201.1 (192.168.201.1) 56(84) bytes of data.
64 bytes from 192.168.201.1: icmp_req=1 ttl=62 time=0.231 ms
--- 192.168.201.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.231/0.231/0.231/0.000 ms
- Код: Выделить всё
root@M10I# run show firewall log
Log :
Time Filter Action Interface Protocol Src Addr Dest Addr
13:32:38 pfe A ae0.0 ICMP 192.168.101.1 192.168.201.1
- Код: Выделить всё
root@t1:~# traceroute 192.168.201.1
traceroute to 192.168.201.1 (192.168.201.1), 30 hops max, 60 byte packets
1 192.168.101.254 (192.168.101.254) 1.068 ms 1.094 ms 1.108 ms
2 192.168.20.2 (192.168.20.2) 0.240 ms 0.227 ms 0.218 ms
3 192.168.201.1 (192.168.201.1) 0.173 ms 0.197 ms 0.181 ms
А вот трасса так и не изменилась, трафик так и не ушел на next-hop.
Вроде в этот раз все описал, схемы сделал. К сожалению не совсем хватает времени на все.