Quando connetto il mio server web da internet, posso collegarmi al mio server web con un altro indirizzo IP globale.
ma quando mi collego dal PC desktop (192.168.0.3) al server Web, il web server aggiunge "192.168.0.1 ..." ai log nonostante mi piacerebbe connettermi con il mio indirizzo IP globale (1.x.2.3).
Per favore insegnami come collegare il web server di rete locale con il mio indirizzo IP globale da dietro nat :)
Grazie per aver letto i miei post.
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
1.x.3.4 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp3s0
# ifconfig
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1 (Local Loopback)
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1454
inet 1.x.3.4 netmask 255.255.255.255 destination 1.x.y.z
ppp txqueuelen 3 (Point-to-Point Protocol)
iptables --table filter --flush
iptables --table nat --flush
iptables -X
iptables --policy INPUT DROP
iptables -t filter -A OUTPUT -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t filter -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t filter -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables --table filter --append INPUT --source 192.168.0.0/24 --protocol all -j ACCEPT
iptables --table nat --append PREROUTING --source 192.168.0.0/24 --in-interface enp3s0 --protocol udp --dport 53 --jump DNAT --to-destination {my ISP DNS IP address}
iptables -t filter -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -i ppp0 -d 1.x.2.3 --dport 80 -j DNAT --to-destination 192.168.0.2:80
iptables --table nat --append PREROUTING --source 192.168.0.0/24 -d 1.x.3.4 --in-interface enp3s0 --protocol tcp --dport 80 --jump DNAT --to-destination 192.168.0.2:80
iptables --table nat --append POSTROUTING --source 192.168.0.0/24 --out-interface enp3s0 --jump MASQUERADE
iptables --table nat --append POSTROUTING --source 192.168.0.0/24 --out-interface ppp0 --jump SNAT --to-source 1.x.3.4
Il mio diagramma di rete. inserisci la descrizione dell'immagine qui