Juniper SRX240 subinterfejsy i NAT

JunOS / Juniper / Netscreen
Wiadomość
Autor
fisch
member
member
Posty: 17
Rejestracja: 25 sty 2011, 19:55

Juniper SRX240 subinterfejsy i NAT

#1

#1 Post autor: fisch »

Mam problem do rozwiązania z NAT na Juniper SRX 240. Jest klika adresów IP. Jeden służy do NAT-u na przeładowanie, reszta do statycznych pojedynczych wpisów, oraz do podpięcia VPN.
NAT na zwykłym interfejsie działa OK, na subinterfejsie z tagiem nie działa. Niestety w przeciwieństwie do CISCO nie można wykreować zwykłych subinterfejsów, tylko subinterfejsy z tagowaniem VLAN.
Problem polega na tym, że potrzebuję przypisać te adresy do subinterfejsów, aby móc wykreować kilka instancji NAT.
Może to jakiś mój błąd w ogólnym podejściu do problemu ?
To nie jest moja pierwsza styczność z Juniperem i nigdy konfiguracja tych urządzeń nie była tak przyjemna i intuicyjna jak CISCO. Niestety nie miałem wpływu na to co wybrał klient i teraz muszę się męczyć z tym cudem.
Pozdrawiam i liczę na wsparcie
Oto mój konfig:

Kod: Zaznacz cały

## Last changed: 2014-03-31 16:05:29 CEST
version 11.4R5.5;
system {
    host-name root;
    domain-name .................;
    time-zone Europe/Warsaw;
    root-authentication {
        encrypted-password "$1$r4Lp45Hs$gcbhU4Qt4HluffNfrcwAj1";
    }
    name-server {
        208.67.222.222;
        208.67.220.220;
    }
    services {
        ssh;
        telnet;
        xnm-clear-text;
        web-management {
            http {
                interface [ vlan.0 ge-0/0/0.0 ];
            }
            https {
                system-generated-certificate;
            }
        }
    }
    syslog {
        archive size 100k files 3;
        user * {
            any emergency;
        }
        file messages {
            any critical;
            authorization info;
        }
        file interactive-commands {
            interactive-commands error;
        }
    }
    max-configurations-on-flash 5;
    max-configuration-rollbacks 5;
    license {
        autoupdate {
            url https://ae1.juniper.net/junos/key_retrieval;
        }
    }
}
interfaces {
    ge-0/0/0 {
        vlan-tagging;
        unit 0 {
            vlan-id 1;
            family inet;
        }
        unit 1111 {
            vlan-id 1111;
            family inet {
                address .................;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/2 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/3 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/4 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/5 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/6 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/7 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/8 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/9 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/10 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/11 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/12 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/13 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/14 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/15 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    vlan {
        unit 0 {
            family inet {
                address 172.16.1.4/16;
            }
        }
    }
}
routing-options {
    static {
        route 0.0.0.0/0 next-hop ................;
    }
}
protocols {
    stp;
}
security {
    screen {
        ids-option untrust-screen {
            icmp {
                ping-death;
            }
            ip {
                source-route-option;
                tear-drop;
            }
            tcp {
                syn-flood {
                    alarm-threshold 1024;
                    attack-threshold 200;
                    source-threshold 1024;
                    destination-threshold 2048;
                    timeout 20;
                }
                land;
            }
        }
    }
    nat {
        source {
            rule-set trust-to-untrust {
                from zone trust;
                to interface ge-0/0/0.1111;
                rule source-nat-rule {
                    match {
                        source-address 172.16.0.0/16;
                        destination-address 0.0.0.0/0;
                    }
                    then {
                        source-nat {
                            interface;
                        }
                    }
                }
            }
        }
    }
    policies {
        from-zone trust to-zone untrust {
            policy trust-to-untrust {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
    }
    zones {
        security-zone trust {
            address-book {
                ...............................
            }
            host-inbound-traffic {
                system-services {
                    all;
                }
                protocols {
                    all;
                }
            }
            interfaces {
                vlan.0;
            }
        }
        security-zone untrust {
            address-book {
             ...............................
              
            }
            screen untrust-screen;
            interfaces {
                ge-0/0/0.0 {
                    host-inbound-traffic {
                        system-services {
                            dhcp;
                            tftp;
                            ping;
                            http;
                            https;
                        }
                    }
                }
                ge-0/0/0.1111;
            }
        }
    }
}
vlans {
    vlan-trust {
        vlan-id 3;
        l3-interface vlan.0;
    }
}

b4n3
wannabe
wannabe
Posty: 128
Rejestracja: 25 cze 2010, 09:58

#2

#2 Post autor: b4n3 »

Wydaje mi się, że masz błędnie skonfigurowane interfejsy każdy sub int musisz dodać do najpierw do vlans, czyli

Kod: Zaznacz cały

vlans {
 NAZWA-INT {
    vlan-id 1111;
    l3-interface vlan.1111;
 }
}
Potem musisz wrócić do interfaces i tam zaadresować vlany

Kod: Zaznacz cały

interfaces {
 vlan {
    unit 1111 {
        description NAZWA-INT
        family inet {
            address 10.2.1.1/24;
        }
    }
}
Potem oczywiście dajesz membera do interfejsu np.

Kod: Zaznacz cały

ge-0/0/1 {
    unit 0 {
        description SW066;
        family ethernet-switching {
            port-mode trunk;
            vlan {
                members [ NAZWA-INT NAZWA-INT2 NAZWA-INT3 ];
            }
        }
    }
}
LUB ACCESS

Kod: Zaznacz cały

ge-0/0/7 {
    unit 0 {
        description ACCESS;
        family ethernet-switching {
            port-mode access;
            vlan {
                members NAZWA-INT
            }
        }
    }
}

michaliwanczuk
wannabe
wannabe
Posty: 187
Rejestracja: 17 kwie 2010, 21:48
Kontakt:

#3

#3 Post autor: michaliwanczuk »

konfigurację masz ok, tylko czy masz routing wskazany tak aby wykonał się nat przez interfejs ge-0/0/0.1111 ?
Michał

fisch
member
member
Posty: 17
Rejestracja: 25 sty 2011, 19:55

#4

#4 Post autor: fisch »

Problem polega też na tym, że po przejściu na tagowany subinterfejs nie można pingować bramy z routera. Więc NAT też nie działa.
Spróbowałem konfiguracji b4n3. Wszystko działa w momencie kiedy port jest w trybie access, po zmianie na trunk nie można nawet pingować bramy z routera pomimo ustawienia
native-vlan-id 1.
Bez zmiany portu na trunk nie można dodawać vlanów, które działałyby jako subinterfejsy. Nie mam już pomysłu jak rozwiązać ten problem.

michaliwanczuk
wannabe
wannabe
Posty: 187
Rejestracja: 17 kwie 2010, 21:48
Kontakt:

#5

#5 Post autor: michaliwanczuk »

a jak masz skonfigurowany port po stronie routera.

opisz dokładnie uzyskać - jaki rodzaj nat?
Michał

fisch
member
member
Posty: 17
Rejestracja: 25 sty 2011, 19:55

#6

#6 Post autor: fisch »

Wszystko jest w konfigu z pierwszego postu.
Tak nie działa nawet pingowanie bramy z routera (chociaż sam interfejs jest up i odpowiada od strony trust):
interfaces {
ge-0/0/0 {
vlan-tagging;
unit 0 {
vlan-id 1;
family inet;
}
unit 1111 {
vlan-id 1111;
family inet {
address 194.............../25;
}
}
}
Tak działa:
ge-0/0/0 {
unit 0 {
family inet {
address 194............./25;
}
}
}
Chociaż interfejs tagowany jest podniesiony i pinguje od strony trust. To w momencie otagowania przestaje działać komunikacji z bramą internetową z routera. W tym momencie NAT nie ma znaczenia skoro nie ma komunikacja z bramą. Jeden IP służy do NAT na przeładowanie, kilka do statycznych NAT-ów i jeden do VPN. Dlatego potrzebne są subinterfejsy.

b4n3
wannabe
wannabe
Posty: 128
Rejestracja: 25 cze 2010, 09:58

#7

#7 Post autor: b4n3 »

Z tego co mi się wydaje to bez trunka nie dasz rady odpalić sub int, bo niby jak jednym kablem poleci ruch dla kilku adresacji bez VLANów? Ogólnie 1 domena broadcast (1 VLAN czyli port access) 1 podsieć.
Myślę, że tutaj musisz albo dogadać trunk, albo po prostu zrobić NAT destination z poolą.
Napisz proszę dokładnie co chcesz osiągnąć, co i jak natować, np.
DST any NAT interface
DST host-a NAT static
DST subnet-b NAT pool-a
SRC subnet-c NAT pool-b
Ostatnio zmieniony 01 kwie 2014, 14:17 przez b4n3, łącznie zmieniany 1 raz.

michaliwanczuk
wannabe
wannabe
Posty: 187
Rejestracja: 17 kwie 2010, 21:48
Kontakt:

#8

#8 Post autor: michaliwanczuk »

tu masz link opisujący konfigurację natów
http://www.juniper.net/techpubs/en_US/j ... eries.html

dla natów statycznych zainteresuj się pojęciem proxy-arp

dla reszty możesz wykorzystać interfejs.
Michał

fisch
member
member
Posty: 17
Rejestracja: 25 sty 2011, 19:55

#9

#9 Post autor: fisch »

To trzeba przenieść na junipera z PIX:

global (outside) 1 212.x
global (outside) 2 212.x
global (outside) 3 212.x
global (outside) 5 212.x
global (outside) 6 212.x
global (outside) 4 212.x
global (outside) 7 212.x
global (outside) 8 x
global (inside) 10 172.16.....
global (inside) 11 interface
global (inside) 2 172.16......
global (inside) 66 .................
nat (inside) 0 access-list inside_outbound_nat0_acl
nat (inside) 1 172.0.0.0 255.0.0.0 0 0
nat (eUrzad) 0 access-list .............._outbound_nat0_acl
nat (eUrzad) 0 x 255.255.255.255 0 0
static (inside,outside) 212.x xxxx netmask 255.255.255.255 0 0
static (inside,outside) 212.x ccccc netmask 255.255.255.255 0 0
static (inside,outside) 212.x 172.16....... netmask 255.255.255.255 0 0

static (inside,outside) 212.x 172.16...... netmask 255.255.255.255 0 0
static (inside,outside) 212.x 172.16...... netmask 255.255.255.255 0 0
static (inside,outside) 212.x 172.16...... netmask 255.255.255.255 0 0

static (inside,outside) 212.x aaaaa netmask 255.255.255.255 0 0
static (inside,outside) peee 172.16........... netmask 255.255.255.255 0 0
static (inside,outside) 212.x aaa netmask 255.255.255.255 0 0

static (inside,outside) 212.x aaa netmask 255.255.255.255 0 0
Ostatnio zmieniony 29 kwie 2014, 14:37 przez fisch, łącznie zmieniany 4 razy.

michaliwanczuk
wannabe
wannabe
Posty: 187
Rejestracja: 17 kwie 2010, 21:48
Kontakt:

#10

#10 Post autor: michaliwanczuk »

to dla mnie
IP NAT overload masz zrobione
jeżeli mówimy o vpn'ach ktore będę na SRX to wykorzystaj już istniejący interfejs.
Jeżeli chodzi o static nat to masz do zrobienia:
Destination Address Translation to a Single Host
przykład ze strony co już dałem link

Kod: Zaznacz cały

set security nat destination pool dnat-pool-1 address 10.1.1.100/32
set security nat proxy-arp interface ge-0/0/0.0 address 1.1.1.100
set security nat destination rule-set dst-nat from zone untrust
set security nat destination rule-set dst-nat rule r1 match destination-address 1.1.1.100
set security nat destination rule-set dst-nat rule r1 then destination-nat pool dnat-pool-1
set security policies from-zone untrust to-zone trust policy dst-nat match source-address any destination-address any application junos-http
set security policies from-zone untrust to-zone trust policy dst-nat then permit
przy tej konfiguracji nie potrzebujesz subinterfejsów tylko dajesz wpis:

Kod: Zaznacz cały

set security nat proxy-arp interface ge-0/0/0.0 address 1.1.1.100
Michał

b4n3
wannabe
wannabe
Posty: 128
Rejestracja: 25 cze 2010, 09:58

#11

#11 Post autor: b4n3 »

przykład Michała powinien zadziałać, jakbyś miał jeszcze jakieś pytania to wal. POMOŻEMY :D

fisch
member
member
Posty: 17
Rejestracja: 25 sty 2011, 19:55

#12

#12 Post autor: fisch »

Mogę zrobić to tak (kilka adresów na interfejsie):
ge-0/0/0 {
unit 0 {
family inet {
address 194.xxx.228/25;
address 194.xxx.231/25;
address 194.xxx.226/25;
}
}
}
Teraz robię NAT na przeładowanie i działa pod warunkiem, że destination to 0.0.0.0/0 jeśli ustawię 194.xxx.226 to pada. Jak w inny sposób wybrać adres do przeładowania ? Pula adresów zawierająca jeden adres ?
nat {
source {
rule-set nat {
from interface vlan.0;
to interface ge-0/0/0.0;
rule dupa {
match {
source-address 172.16.0.0/16;
destination-address 0.0.0.0/0; //zmiana na adres interfejsu ge-0/0/0.0 psuje nat
}
then {
source-nat {
interface;
}
}
}
}
}
}
Pozostaje jeszcze kwestia VPN. W konfiguracji wskazuje źródłowy interfejs. Pytanie teraz, który adres z tego interfejsu będzie teraz peerem dla drugiej strony ?
Ostatnio zmieniony 29 kwie 2014, 14:38 przez fisch, łącznie zmieniany 1 raz.

b4n3
wannabe
wannabe
Posty: 128
Rejestracja: 25 cze 2010, 09:58

#13

#13 Post autor: b4n3 »

destination to sieć/host docelowa, nie ma sensu ustawiać IP interfejsu, wg mnie.
Jeśli chcesz wybrać adres do przeładowania to robisz

Kod: Zaznacz cały

set security nat source pool TEST address 1.1.1.1 to 1.1.1.10
set security nat source rule-set nat rule dupa then source-nat pool TEST
W puli ustawiasz adres na kt chcesz NATOWAĆ, oczywiście możesz wiele rule dupa zrobić i tam inne matche i inne pool

Dodatkowo zmieniłbym

Kod: Zaznacz cały

from interface vlan.0; 
to interface ge-0/0/0.0; 
na
from zone trust; 
to zone utrust;
aby był ładny porządeczek i wiadomo było o co chodzi (masz ZONE a nie interfejsy więc w przypadku dodania czegoś lub zmiany (w interfejsach) config Ci się nie rozsypie.

fisch
member
member
Posty: 17
Rejestracja: 25 sty 2011, 19:55

#14

#14 Post autor: fisch »

A jak zrobić na Juniper
ip nat inside source static 172.16.10.5 64.64.64.65

b4n3
wannabe
wannabe
Posty: 128
Rejestracja: 25 cze 2010, 09:58

#15

#15 Post autor: b4n3 »

fisch pisze:A jak zrobić na Juniper
ip nat inside source static 172.16.10.5 64.64.64.65
to z PIXa jest? bo na ASA nie ma takiej opcji.. Tutaj chodzi o to, że source 172.16.10.5 jak idzie do 64.64.64.65 to ma być zamieniony na IP interfejsu INSIDE?

ODPOWIEDZ