Ufw forward

Installazione, configurazione e uso di Ubuntu come server: web, ftp, mail, news, proxy, dns e altro.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 14027
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: Ufw forward

Messaggio da thece »

@vsphere Novita?
I'm #1 so why not try: sudo rm -rf / ?
vsphere
Prode Principiante
Messaggi: 10
Iscrizione: venerdì 7 giugno 2024, 7:49
Distribuzione: 22.04

Re: Ufw forward

Messaggio da vsphere »

Ciao.
Scusa il ritardo...... Putroppo no!
Per il momento ho fatto collegare il tecnico del centralino su di un pc con AnyDesk e accesso vigilato.
No c'è stato verso e ne ho provate tante. Alla fine resterà così, anche se la cosa mi infastidisce.....
grazie comunque dell'interessamento.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 14027
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: Ufw forward

Messaggio da thece »

Io la soluzione testata e funzionante te l'ho indicata ...



[EDIT]

Spero che modificare gli indirizzi IP rispetto alla mia prova non sia un problema.



SERVER

Su SERVER è installato il server DHCP per la LAN 10.0.2.0 / 24

Codice: Seleziona tutto

cat /proc/sys/net/ipv4/ip_forward

1

Codice: Seleziona tutto

ip a

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether <REDACTED> brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.23/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether <REDACTED> brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.23/24 brd 10.0.2.255 scope global eth1
       valid_lft forever preferred_lft forever

Codice: Seleziona tutto

ip r

default via 192.168.0.1 dev eth0 onlink 
10.0.2.0/24 dev eth1 proto kernel scope link src 10.0.2.23 
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.23

Codice: Seleziona tutto

sudo netstat -tulnp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1213/sshd: /usr/sbi 
tcp6       0      0 :::22                   :::*                    LISTEN      1213/sshd: /usr/sbi 
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1649/dhcpd
Il firewall UFW è attivo

Codice: Seleziona tutto

(questa lavora sulla catena di FORWARD, per UFW: ROUTED)
sudo ufw default allow FORWARD

(queste lavorano sulla catena di INPUT, per UFW: INCOMING)
sudo ufw allow SSH
sudo ufw allow bootps comment 'Allow DHCP'
sudo ufw allow bootpc comment 'Allow DHCP'

Codice: Seleziona tutto

sudo ufw status verbose

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), allow (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere                   # Allow SSH
22/tcp (SSH)               ALLOW IN    Anywhere                  
67/udp                     ALLOW IN    Anywhere                   # Allow DHCP
68/udp                     ALLOW IN    Anywhere                   # Allow DHCP
22/tcp (v6)                ALLOW IN    Anywhere (v6)              # Allow SSH
22/tcp (SSH (v6))          ALLOW IN    Anywhere (v6)             
67/udp (v6)                ALLOW IN    Anywhere (v6)              # Allow DHCP
68/udp (v6)                ALLOW IN    Anywhere (v6)              # Allow DHCP


CLIENT su Internet (non rappresentato nello schema)

Codice: Seleziona tutto

ip a

4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether <REDACTED> brd ff:ff:ff:ff:ff:ff
    inet 192.168.184.229/24 brd 192.168.184.255 scope global dynamic noprefixroute usb0
       valid_lft 3237sec preferred_lft 3237sec

Codice: Seleziona tutto

ip r

default via 192.168.184.236 dev usb0 proto dhcp src 192.168.184.229 metric 100 
169.254.0.0/16 dev usb0 scope link metric 1000 
192.168.184.0/24 dev usb0 proto kernel scope link src 192.168.184.229 metric 100
Test di connessione dal CLIENT verso il WEB SERVER utilizzando netcat

Codice: Seleziona tutto

nc -v AAA.BBB.CCC.DDD 8080

<REDACTED> [AAA.BBB.CCC.DDD] 8080 (http-alt) open


Web Server

Ho simulato il tuo Centralino VoIP con Apache

Codice: Seleziona tutto

ip a

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether <REDACTED> brd ff:ff:ff:ff:ff:ff
    altname enp1s0
    inet 10.0.2.100/24 brd 10.0.2.255 scope global dynamic noprefixroute eth0
       valid_lft 2924sec preferred_lft 2924sec

Codice: Seleziona tutto

ip r

default via 10.0.2.23 dev eth0 proto dhcp src 10.0.2.100 metric 100 
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.100 metric 100 
169.254.0.0/16 dev eth0 scope link metric 1000 

Codice: Seleziona tutto

sudo netstat -tulnp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      836/sshd: /usr/sbin 
tcp6       0      0 :::80                   :::*                    LISTEN      858/apache2         
tcp6       0      0 :::22                   :::*                    LISTEN      836/sshd: /usr/sbin 
Test di connessione dal CLIENT verso il WEB SERVER, catturato su WEB SERVER tramite packet sniffer

Codice: Seleziona tutto

sudo tcpdump -i eth0 -v -n -tttt tcp port 80

tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
2024-07-17 21:45:35.662560 IP (tos 0x0, ttl 51, id 57140, offset 0, flags [DF], proto TCP (6), length 60)
    <REDACTED>.39924 > 10.0.2.100.80: Flags [S], cksum 0xfe1b (correct), seq 333716130, win 64240, options [mss 1310,sackOK,TS val 3092106677 ecr 0,nop,wscale 7], length 0
2024-07-17 21:45:35.662592 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    10.0.2.100.80 > <REDACTED>.39924: Flags [S.], cksum 0xfee9 (incorrect -> 0x716c), seq 2621473552, ack 333716131, win 65160, options [mss 1460,sackOK,TS val 2459555461 ecr 3092106677,nop,wscale 7], length 0
2024-07-17 21:45:35.720381 IP (tos 0x0, ttl 51, id 57141, offset 0, flags [DF], proto TCP (6), length 52)
    <REDACTED>.39924 > 10.0.2.100.80: Flags [.], cksum 0x9c7d (correct), ack 1, win 502, options [nop,nop,TS val 3092106755 ecr 2459555461], length 0
2024-07-17 21:45:41.342427 IP (tos 0x0, ttl 51, id 57142, offset 0, flags [DF], proto TCP (6), length 52)
    <REDACTED>.39924 > 10.0.2.100.80: Flags [F.], cksum 0x8685 (correct), seq 1, ack 1, win 502, options [nop,nop,TS val 3092112378 ecr 2459555461], length 0
2024-07-17 21:45:41.342560 IP (tos 0x0, ttl 64, id 31768, offset 0, flags [DF], proto TCP (6), length 52)
    10.0.2.100.80 > <REDACTED>.39924: Flags [.], cksum 0xfee1 (incorrect -> 0x704d), ack 2, win 510, options [nop,nop,TS val 2459561141 ecr 3092112378], length 0
2024-07-17 21:45:41.342980 IP (tos 0x0, ttl 64, id 31769, offset 0, flags [DF], proto TCP (6), length 52)
    10.0.2.100.80 > <REDACTED>.39924: Flags [F.], cksum 0xfee1 (incorrect -> 0x704c), seq 1, ack 2, win 510, options [nop,nop,TS val 2459561141 ecr 3092112378], length 0
2024-07-17 21:45:41.391772 IP (tos 0x0, ttl 51, id 0, offset 0, flags [DF], proto TCP (6), length 52)
    <REDACTED>.39924 > 10.0.2.100.80: Flags [.], cksum 0x701d (correct), ack 2, win 502, options [nop,nop,TS val 3092112433 ecr 2459561141], length 0
A questo punto direi che adesso hai in mano tutto quello che ti occorre per mettere in campo la soluzione.
Allegati
network.png
screenshot_02.png
screenshot_01.png
I'm #1 so why not try: sudo rm -rf / ?
Scrivi risposta

Ritorna a “Ubuntu su server”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 1 ospite