1 (edytowany przez Camis 2020-09-05 16:01:58)

Temat: N2N - Problem z przekierowaniem portu

Mam sieć:


Punkt 1 (WAN z publicznym IP, postawiony na nim supernode).    LAN 10.0.10.1/24    / N2N  1.2.3.4

Punkt 2 (WAN LTE bez publika).    LAN  192.168.1.1/24   /  N2N  1.2.3.5



Teraz tak, pingi między p1 i p2 chodzą, tak więc sieć n2n działa.


Potrzebuję przekierować z p1: publicznyIP:4050 na p2 IP 192.168.1.20:443.


Pomoże ktoś co jest źle?, walcze juz kilka godzin i nadal lipa sad.






/etc/config/n2n-edge.conf

#
#         The configuration file is similar to the command line, with one option per line. An equal
#        sign '=' should be used between key and value. Example: -c=mynetwork or --community=mynetwork
#        This file contains a basic configuration example, please refer to the help (-h) for the full
#        list of available options.
#
#       -d|--tun-device
#        Specifies the name of the TUN interface. 
#
-d=n2n0
#
#       -c|--community
#        Specifies the n2n community name the edge belongs to.
#
-c=AP-***
#
#       -k
#        Sets the encryption key (ASCII). The environment variable N2N_KEY=<key> can also be used. 
#
-k=*********************
#
#       -m
#        Specified the MAC address for the TAP interface (random otherwise).
#
-m=DE:**:**:EF:**:**
#
#       -a
#        Sets the interface address. For DHCP use '-r -a dhcp:0.0.0.0'.
#
-a 1.2.3.4
#
#       -p
#        Sets the local UDP port to a fixed port.
#
#-p=50001
#
#       -l|--supernode-list
#        Specifies the supernode IP and port.
#
-l=85.***:***
#
-r



/etc/config/network

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'

config interface 'lan'
    option type 'bridge'
    option proto 'static'
    option netmask '255.255.255.0'
    option ifname 'eth0.10'
    option ipaddr '10.0.10.1'

config device 'lan_dev'
    option name 'eth0.1'
    option macaddr '*****'

config interface 'wan'
    option proto 'dhcp'
    option macaddr '****'
    option peerdns '0'
    list dns '127.0.0.1'
    option ifname 'eth0.20'

config device 'wan_dev'
    option name 'eth0.2'
    option macaddr '***'

config interface 'n2n'
    option proto 'static'
    option ifname 'n2n0'


/etc/config/firewall

config defaults
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'REJECT'
    option flow_offloading '1'
    option flow_offloading_hw '1'
    option synflood_protect '1'

config zone
    option name 'wan'
    option output 'ACCEPT'
    option masq '1'
    option mtu_fix '1'
    option network 'wan'
    option input 'REJECT'
    option forward 'ACCEPT'

config zone
    option name 'lan'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'ACCEPT'
    option network 'lan'

config forwarding
    option src 'lan'
    option dest 'wan'


config include
    option path '/etc/firewall.user'


config rule
    option src 'wan'
    option target 'ACCEPT'
    option name 'n2n'
    option dest_port '7654'
    list proto 'udp'

config zone
    option name 'n2n'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option network 'n2n'
    option masq '1'
    option forward 'ACCEPT'

config forwarding
    option dest 'lan'
    option src 'n2n'

config forwarding
    option dest 'n2n'
    option src 'lan'

config forwarding
    option dest 'n2n'
    option src 'wan'

config forwarding
    option dest 'wan'
    option src 'lan'

config forwarding
    option dest 'wan'
    option src 'n2n'

config redirect 'n2n_443'
    option name 'n2n_443'
    option dest 'n2n'
    option dest_port '443'
    list proto 'tcp'
    list proto 'udp'
    option dest_ip '1.2.3.5'
    option src_dport '4050'
    option src 'n2n'

config forwarding
    option dest 'lan'
    option src 'wan'

2 (edytowany przez Cezary 2020-09-06 17:32:47)

Odp: N2N - Problem z przekierowaniem portu

src jako wan nie n2n? To z wanu robisz przekierowanie w tunel.

EDIT: dokładnie to takie coś działa, właśnie sprawdziłem:

iptables -t nat -I PREROUTING -d ip-na-wanie -p tcp --dport 4500 -j DNAT --to-dest 1.2.3.5:443
iptables -t nat -I POSTROUTING -d 1.2.3.5 -p tcp --dport 443 -j SNAT --to-source 1.2.3.4

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.