FIREWALL con due schede di rete
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
FIREWALL con due schede di rete
Salve a tutti, vorrei creare un firewall con due schede di rete per permettere alla mia rete interna LAN di essere protetta da eventuali intrusioni.
Ho una scheda di rete collegata direttamente al router internet e l'altra alla mia LAN
Sto provando a configurare il tutto ma non riesco, anche perchè trovo delle discordanze tra webmin e ufw
potete aiutarmi?
Grazie
Ho una scheda di rete collegata direttamente al router internet e l'altra alla mia LAN
Sto provando a configurare il tutto ma non riesco, anche perchè trovo delle discordanze tra webmin e ufw
potete aiutarmi?
Grazie
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
attualmente il mio if config è il seguente
Codice: Seleziona tutto
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.201 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::21b:fcff:fefc:41eb prefixlen 64 scopeid 0x20<link>
ether 00:1b:fc:fc:41:eb txqueuelen 1000 (Ethernet)
RX packets 17596 bytes 3001843 (3.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15603 bytes 7819684 (7.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 2 collisions 0
enp5s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::21e:58ff:fe31:4bc5 prefixlen 64 scopeid 0x20<link>
ether 00:1e:58:31:4b:c5 txqueuelen 1000 (Ethernet)
RX packets 41 bytes 5586 (5.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 45 bytes 4790 (4.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 670 bytes 52570 (52.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 670 bytes 52570 (52.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
la enp2s0 è collegata con il mio router
la enp5s1 alla lan
In realtà questa dovrebbe essere la configurazione finale.
Attualmente ho la mia lan collegata al router così come il firewall tramite enp2s0 e sulla enp5s1 ho uno switch con collegato un portatile così da simulare la situazione finale (non posso bloccare la mia rete per fare dei test)
Grazie
la enp5s1 alla lan
In realtà questa dovrebbe essere la configurazione finale.
Attualmente ho la mia lan collegata al router così come il firewall tramite enp2s0 e sulla enp5s1 ho uno switch con collegato un portatile così da simulare la situazione finale (non posso bloccare la mia rete per fare dei test)
Grazie
- Filoteo
- Entusiasta Emergente
- Messaggi: 1315
- Iscrizione: venerdì 28 agosto 2015, 9:38
- Desktop: Gnome
- Distribuzione: Arch Linux
Re: FIREWALL con due schede di rete
Dovresti definire esattamente come vuoi realizzarlo. Vuoi creare una sottorete diversa da 192.168.1.0/24? Il PC dovrà avere un server DHCP? Server DNS? Il firewall come lo vuoi? Vuoi che blocchi tutte le richieste dall’esterno e consentire quelle dall’interno della rete (cioè lo switch)?
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
Ubuntu Linux 18.04
/etc/network/interface
/etc/netplan/50-cloud-init.yaml
In pratica vorrei che tutto il traffico in entrata dal router fosse bloccato e invece quello in uscita dalla lan abilitato.
Cioè permettere ai PC collegati al firewall di andare su internet e prevenire eventuali intrusioni
Potrebbe anche fareda DHCP server come da VNC server, ma un passo alla volta
adesso la rete è 192.168.1.0/24
preferirei lasciarla così
/etc/network/interface
Codice: Seleziona tutto
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
Codice: Seleziona tutto
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp2s0:
addresses:
- 192.168.1.201/24
gateway4: 192.168.1.1
nameservers:
addresses:
- 85.18.200.200
- 89.97.140.140
- 8.8.8.8
- 8.8.4.4
search: []
optional: true
enp5s1:
addresses:
- 192.168.1.202/24
gateway4: 192.168.1.201
nameservers:
addresses:
- 85.18.200.200
- 89.97.140.140
- 8.8.8.8
- 8.8.4.4
search: []
optional: true
version: 2
Cioè permettere ai PC collegati al firewall di andare su internet e prevenire eventuali intrusioni
Potrebbe anche fareda DHCP server come da VNC server, ma un passo alla volta
adesso la rete è 192.168.1.0/24
preferirei lasciarla così
Ultima modifica di ilperu il lunedì 25 giugno 2018, 18:14, modificato 2 volte in totale.
- Filoteo
- Entusiasta Emergente
- Messaggi: 1315
- Iscrizione: venerdì 28 agosto 2015, 9:38
- Desktop: Gnome
- Distribuzione: Arch Linux
Re: FIREWALL con due schede di rete
Ho aggiornato la domanda
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
......avevo già risposto
- Filoteo
- Entusiasta Emergente
- Messaggi: 1315
- Iscrizione: venerdì 28 agosto 2015, 9:38
- Desktop: Gnome
- Distribuzione: Arch Linux
Re: FIREWALL con due schede di rete
Mmmmh, ok proviamoci. Intanto disinstalla completamente ufw con quindi riavvia per essere sicuri di aver pulito le regole del firewall.
Useremo iptables che dà un maggior controllo. Installa iptables-persistent per gestire le regole Alla richiesta di salvare le regole attuali metti sì.
Fai giusto una prova per vedere se NON FUNZIONA. Connetti un client allo switch e prova a connetterti a internet/vedere se il client riceve l’ip dal router.
Adesso posta l’output di
Codice: Seleziona tutto
sudo apt-get purge ufw
Useremo iptables che dà un maggior controllo. Installa iptables-persistent per gestire le regole
Codice: Seleziona tutto
sudo apt-get install iptables-persistent
Fai giusto una prova per vedere se NON FUNZIONA. Connetti un client allo switch e prova a connetterti a internet/vedere se il client riceve l’ip dal router.
Adesso posta l’output di
Codice: Seleziona tutto
sudo iptables -vnL
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
Fatto tutto, ecco l'output
Codice: Seleziona tutto
Chain INPUT (policy ACCEPT 23614 packets, 3899K bytes)
pkts bytes target prot opt in out source destination
29179 4787K ufw-before-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
29179 4787K ufw-before-input all -- * * 0.0.0.0/0 0.0.0.0/0
24103 3958K ufw-after-input all -- * * 0.0.0.0/0 0.0.0.0/0
23614 3899K ufw-after-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
23614 3899K ufw-reject-input all -- * * 0.0.0.0/0 0.0.0.0/0
23614 3899K ufw-track-input all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ufw-before-logging-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-before-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-after-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-after-logging-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-reject-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-track-forward all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 22903 packets, 14M bytes)
pkts bytes target prot opt in out source destination
27546 15M ufw-before-logging-output all -- * * 0.0.0.0/0 0.0.0.0/0
27546 15M ufw-before-output all -- * * 0.0.0.0/0 0.0.0.0/0
22926 14M ufw-after-output all -- * * 0.0.0.0/0 0.0.0.0/0
22926 14M ufw-after-logging-output all -- * * 0.0.0.0/0 0.0.0.0/0
22926 14M ufw-reject-output all -- * * 0.0.0.0/0 0.0.0.0/0
22926 14M ufw-track-output all -- * * 0.0.0.0/0 0.0.0.0/0
Chain WEBMIN (0 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 192.168.1.56 0.0.0.0/0
0 0 ACCEPT all -- enp5s1 * 0.0.0.0/0 0.0.0.0/0
Chain ufw-after-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-logging-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-logging-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-output (1 references)
pkts bytes target prot opt in out source destination
- Filoteo
- Entusiasta Emergente
- Messaggi: 1315
- Iscrizione: venerdì 28 agosto 2015, 9:38
- Desktop: Gnome
- Distribuzione: Arch Linux
Re: FIREWALL con due schede di rete
Hai riavviato il PC prima di installare iptables-persistant? Chiedo perché sono rimaste le vecchie regole di ufw.
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
ho rifatto...
ecco l'output
ecco l'output
Codice: Seleziona tutto
Chain INPUT (policy ACCEPT 77 packets, 12915 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 62 packets, 7406 bytes)
pkts bytes target prot opt in out source destination
- Filoteo
- Entusiasta Emergente
- Messaggi: 1315
- Iscrizione: venerdì 28 agosto 2015, 9:38
- Desktop: Gnome
- Distribuzione: Arch Linux
Re: FIREWALL con due schede di rete
Fatta la prova con lo switch?
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
si, non funziona
- thece
- Tenace Tecnocrate
- Messaggi: 12919
- Iscrizione: lunedì 23 aprile 2007, 14:16
- Distribuzione: Debian 12 (Bookworm) - KDE
Re: FIREWALL con due schede di rete
@ilperuilperu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5066820#p5066820][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: attualmente il mio if config è il seguenteenp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.201 netmask 255.255.255.0 broadcast 192.168.1.255
...
enp5s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255
...
Quanto ne sai di Teoria delle Reti di Calcolatori?
Ultima modifica di thece il mercoledì 27 giugno 2018, 0:30, modificato 1 volta in totale.
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
..qualcosina, non sono un espertissimo però
- Filoteo
- Entusiasta Emergente
- Messaggi: 1315
- Iscrizione: venerdì 28 agosto 2015, 9:38
- Desktop: Gnome
- Distribuzione: Arch Linux
Re: FIREWALL con due schede di rete
Vogliamo che i pacchetti passino dall’interfaccia collegata allo switch a quella collegata al router. Proviamo attivando il forwarding IPv4.
Visto che iptables ha la policy FORWARD su ACCEPT (passa tutto di default) potrebbe già funzionare. Ricolegga un client allo switch e prova.
Codice: Seleziona tutto
sudo sed "/net.ipv4.ip_forward=1/s/^#//g" -i /etc/sysctl.conf
sudo sysctl -p
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
fatto ma non funziona
- thece
- Tenace Tecnocrate
- Messaggi: 12919
- Iscrizione: lunedì 23 aprile 2007, 14:16
- Distribuzione: Debian 12 (Bookworm) - KDE
Re: FIREWALL con due schede di rete
Perdonami la risposta "cattiva", ma ti suggerisco di arricchire il "qualcosina" con:ilperu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5066856#p5066856][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: ..qualcosina, non sono un espertissimo però
- uso dell'indirizzo IP e della netmask
- rudimenti della tabella di routing
Come si configura il firewall viene dopo.
-
- Prode Principiante
- Messaggi: 44
- Iscrizione: mercoledì 13 dicembre 2017, 15:25
- Distribuzione: ubuntu
- Sesso: Maschile
Re: FIREWALL con due schede di rete
per quelli dovrei essercithece [url=https://forum.ubuntu-it.org/viewtopic.php?p=5066860#p5066860][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto:ilperu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5066856#p5066856][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto:
- uso dell'indirizzo IP e della netmask
- rudimenti della tabella di routing
.
- thece
- Tenace Tecnocrate
- Messaggi: 12919
- Iscrizione: lunedì 23 aprile 2007, 14:16
- Distribuzione: Debian 12 (Bookworm) - KDE
Re: FIREWALL con due schede di rete
Ti suggerisco di rivedere la teoria alla luce degli output affiancati dei comandi ifconfig e route -nilperu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5066861#p5066861][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: per quelli dovrei esserci
Chi c’è in linea
Visualizzano questa sezione: 0 utenti iscritti e 6 ospiti