Forigate 30D: dynamische IP / dynamisches Gateway und statisches Routing

Wie sieht es aus, wenn ein Router via DHCP (PPPeE) ein dynamisches Gateway bekommt, auf das statische Routen gelegt werden sollen? Gezeigt wird auch, wie man statische Routen konfiguriert.

Zuerst schauen wir mal, wie man sich das aktuelle Routing anzeigen kann, wenn bereits Routen existieren:

Routen anzeigen

Fortigate1 # get router info routing-table all

Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default

S* 0.0.0.0/0 [10/0] via 192.168.183.254, wan1
S 10.0.0.0/24 [10/0] is directly connected, ssl.root
R 10.0.0.1/32 [120/2] via 192.168.182.110, wan1, 00:34:52
R 10.0.0.2/32 [120/2] via 192.168.182.110, wan1, 00:34:52
C 10.160.0.0/23 is directly connected, internal
R 10.161.0.0/23 [120/2] via 192.168.182.58, wan1, 00:35:27
S 30.0.0.0/8 [10/0] is directly connected, ssl.root
R 172.16.30.0/24 [120/2] via 192.168.182.110, wan1, 00:34:52
C 192.168.182.0/23 is directly connected, wan1

Statische Routen konfigurieren

Einzelne Routen in der Konfiguration anzeigen

Jede Route bekommt eine nummerische Bezeichnung, hier eine 1 und eine 2

fortigate1 # config router static

fortigate1 (static) # show
    edit 1
        set device "ERFURT"
        set comment "Route in den VPN Tunnel"
    next
    edit 2
        set dst 185.9.108.0 255.255.252.0
        set device "wan"
        set comment "Erfurt Datacenter"
        set dynamic-gateway enable
    next
end

… oder etwas einfachen nur so:

fortigate1 # show router static 

config router static
     edit 1
        set device "ERFURT"
        set comment "Route in den VPN Tunnel"
    next
    edit 2
        set dst 185.9.108.0 255.255.252.0
        set device "wan"
        set comment "Erfurt Datacenter"
        set dynamic-gateway enable
    next
end

Route hinzufügen und danach anzeigen:

fortigate1 # config router static                 

fortigate1 (static) # edit 12                       
new entry '12' added

fortigate1 (12) # set device wan

fortigate1 (12) # set dst 94.199.241.18 255.255.255.255

fortigate1 (12) # set comment "PRTG Alfahosting"

FG-GS-Gotha (12) # show
config router static
    edit 12
        set dst 94.199.241.18 255.255.255.255
        set device "wan"
        set comment "PRTG Alfahosting"
    next
end

Und jetzt zum eigentlichen Thema

Gateway via DHCP (PPPoE) und statische Routen“

Gebraucht wird eine statische Route, die auf das DHCP default Gateway zeigen sollte.

Fortinet schreibt hierzu:

„When an interface has some form of changing IP address (DDNS, PPPoE, or DHCP assigned address), routing needs special attention. The standard static route cannot handle the changing IP address. The solution is to use the dynamic-gateway command in the CLI. Say for example you already have four static routes, and you have a PPPoE connection over the wan2 interface and you want to use that as your default route. The route is configured on the dynamic address VPN peer trying to access the static address FortiGate unit.“

Und so wird die Route angelegt, die Zeile

  set dynamic-gateway enable

bewirkt, dass für die Route auf das dynamische Gateway gelegt wird.

config router static
    edit 2
          set dst 185.9.108.0 255.255.252.0
          set dynamic-gateway enable
          set device wan
          set comment "Erfurt Datacenter"
    next
end

Ergebnis anzeigen:

fortigate1 # show router static 2
config router static
    edit 2
        set dst 185.9.108.0 255.255.252.0
        set device "wan"
        set comment "Erfurt Datacenter"
        set dynamic-gateway enable
    next
end

 

In der Liste finden wir die gesetzte Route jedoch nicht, hier werden nur die aktiven Routen angezeigt. Dazu muss die option DATABASE genutzt werden:

FG # get router info routing-table database 
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
       O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       > - selected route, * - FIB route, p - stale info

S       0.0.0.0/0 [10/0] via 10.196.9.101, ERFURT inactive
C    *> 10.200.9.0/24 is directly connected, lan4
S       176.28.45.241/32 [10/0] via 193.158.105.153, wan inactive
S       185.9.108.0/22 [10/0] via 193.158.105.153, wan inactive

 

 

 

 

 

http://kb.fortinet.com/kb/viewContent.do?externalId=FD31207

 

 

 

Routing