Hi guys,
so i have an OVH dedicated server, i installed Proxmox on it. I created 2 VMs, one freebsd VM as a firewall / NAT gateway and one Debian server in the same lan as the firewall with the FreeBSD as Gateway.
On the FreeBSD VM there are 2 net cards, one for the WAN, one for the LAN.
From the FreeBSD i have internet access, i can ping, telnet etc ... all is working from the Firewall / Gateway.
From the Debian server i can ping the internet, i can ping 8.8.8.8.
I have multiples problems :
- From the Debian server, the command telnet 1.1.1.1 53 but telnet 8.8.8.8 53 doesn't works (so i configured /etc/resolv.conf with 1.1.1.1 to be able to use domains but this problem is pretty weird)
- From the Debian server, the command telnet google.com 80 doesn't works (it works from the FreeBSD firewall)
- When i try to connect from my pc with SSH or telnet ip 2223 on the Debian server, i see the packets with tcpdump (on the Debian server) but i have a timeout on the command
Here is what i see on my logs when i do the command doas tcpdump -n -e -ttt -i pflog0 :
Here are my rules :
Thank you in advance for your advices / help !
Regards,
Maxime
so i have an OVH dedicated server, i installed Proxmox on it. I created 2 VMs, one freebsd VM as a firewall / NAT gateway and one Debian server in the same lan as the firewall with the FreeBSD as Gateway.
On the FreeBSD VM there are 2 net cards, one for the WAN, one for the LAN.
From the FreeBSD i have internet access, i can ping, telnet etc ... all is working from the Firewall / Gateway.
From the Debian server i can ping the internet, i can ping 8.8.8.8.
I have multiples problems :
- From the Debian server, the command telnet 1.1.1.1 53 but telnet 8.8.8.8 53 doesn't works (so i configured /etc/resolv.conf with 1.1.1.1 to be able to use domains but this problem is pretty weird)
- From the Debian server, the command telnet google.com 80 doesn't works (it works from the FreeBSD firewall)
- When i try to connect from my pc with SSH or telnet ip 2223 on the Debian server, i see the packets with tcpdump (on the Debian server) but i have a timeout on the command
Here is what i see on my logs when i do the command doas tcpdump -n -e -ttt -i pflog0 :
Code:
(telnet 8.8.8.8 53) 00:00:00.000010 rule 19/0(match): pass out on vtnet1: 91.121.40.45.52818 > 8.8.8.8.53: Flags [S], [/S]seq 688104303, win 64240, options [mss 1460,sackOK,TS val 3854927016 ecr 0,nop,wscale 7], length 0
(telnet 1.1.1.1 53) 00:00:00.000010 rule 19/0(match): pass out on vtnet1: 91.121.40.45.53578 > 1.1.1.1.53: Flags , seq 537632035, win 64240, options [mss 1460,sackOK,TS val 3337238453 ecr 0,nop,wscale 7], length 0
(telnet google.com 80) 00:00:00.000004 rule 19/0(match): pass out on vtnet1: 91.121.40.45.60204 > 142.250.178.14.80: Flags , seq 556080316, win 64240, options [mss 1460,sackOK,TS val 2506116294 ecr 0,nop,wscale 7], length 0
(when i connect from the client to the debian server on ssh)
00:00:01.249859 rule 18/0(match): pass in on vtnet1: my ip.63990 > 192.168.10.10.2223: Flags , seq 2851206258, win 64240, options [mss 1460,sackOK,TS val 3746771 ecr 0,nop,wscale 7], length 0
00:00:00.000005 rule 17/0(match): pass out on vtnet0: my ip.63990 > 192.168.10.10.2223: Flags , seq 2851206258, win 64240, options [mss 1460,sackOK,TS val 3746771 ecr 0,nop,wscale 7], length 0
Here are my rules :
Code:
## Macros
ext_if = "vtnet1" # External interface (WAN)
int_if = "vtnet0" # Internal interface (LAN)
ext_ip = "91.121.40.45"
int_ip = "192.168.10.1"
# Define the internal server IP
internal_server = "192.168.10.10"
int_network = "192.168.10.0/24"
# Services allowed for outgoing traffic
tcp_pass_out = "{ bootpc, bootps, dhcpv6-client, dhcpv6-server, domain, https, ipp, nicname, ntp, ssh, www, 6667, 6697 }"
udp_pass_out = "{ bootpc, bootps, dhcpv6-client, dhcpv6-server, domain, nicname, ntp }"
icmp_ok_types = "{ echoreq, unreach }"
# Tables for allowed IPs for SSH and FTP access
table <allowed_ssh> persist file "/etc/hh.d/acls/hh_home.txt"
table <allowed_ftp> persist file "/etc/hh.d/acls/hh_home.txt"
table <private> const { 10/8, 172.16/12, 192.168/16 }
## Let free traffic on the loopback interface lo0
set skip on lo0
## Normalization and reassembly of packets
scrub in all
## Translation (NAT for internal network)
nat on $ext_if from $int_network to any -> ($ext_if)
## Port Redirection (for SSH and FTP access)
rdr on $ext_if proto tcp from <allowed_ssh> to $ext_if port 2223 -> $internal_server
rdr on $ext_if proto tcp from <allowed_ftp> to $ext_if port {20, 21, 10000:19999} -> $internal_server
## Filtering
# Default policy: block everything
#block all
### Filters ###
# Permit any packets from internal network to any
pass in on $int_if inet from $int_network to any keep state
## Allow inbound SSH connections from allowed IPs
##Port 2222 firewall freebsd
pass in on $ext_if proto tcp from <allowed_ssh> to $ext_if port 2222 keep state
##Port 2223 web server
pass in on $ext_if proto tcp from <allowed_ssh> to $ext_if port 2223 keep state
## Allow inbound FTP connections (ports 20, 21, passive range 10000-19999) from allowed IPs
pass in on $ext_if proto tcp from <allowed_ftp> to $ext_if port {20, 21, 10000:19999} keep state
## Allow HTTP (80) and HTTPS (443) traffic for everyone
pass in on $ext_if proto tcp from any to $ext_if port { 80 443 } flags S/SA keep state
## Allow DNS and NTP traffic
pass in on $ext_if proto { tcp udp } from any to $ext_if port { domain ntp } keep state
pass out on $int_if from any to $int_if:network keep state
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto { udp, icmp } all keep state
# Permit and log all packets from clients in private network through NAT
pass in log on $int_if all
pass out log on $int_if all
pass in log on $ext_if all
pass out log on $ext_if all
Thank you in advance for your advices / help !
Regards,
Maxime