lkarlslund / deploy-goad

Script to install prerequisites for deploying GOAD on Ubuntu Linux 22.04
105 stars 12 forks source link

Route doesn't seem to work :( #7

Open chrisstigson opened 8 months ago

chrisstigson commented 8 months ago

I have used bare metal Ubuntu 22.0.4 install. With a wifi-card to a router with192.168.1.1 using DHCP

My ubuntu install is on 192.168.1.42 (ssh works from windows/kali) I have another box that is physically connected to 192.168.1.67 through Virtualbox (bridged) on another physical PC (kali)

In the end I get: "Deployment succeeded, your lab is now up and running on the 192.168.56.0/24 network", and surely I can ping things inside from the SSH sessions or kali to 192.168.1.42

Now I've added the route

sudo ip route add 192.168.56.0/24 via 192.168.1.42 (in kali)

From kali I get ping response from 192.168.1.42(ubuntu), but not 192.168.56.10 for example,.

cme smb 192.168.56.0/24 doesn't get any responses. nmap 192.168.56.0/24 is dead, except 192.168.56.1

So I am thinking the problem is within the ubuntubox somehow. I've tried lots of manulas and routing, opening and disabling firewalls etc...

Do I need to attack my network from the ubuntubox?

It seems 192.168.56.1 is "router in NAT mode"

┌──(kali㉿kali)-[~] └─$ sudo ip route add 192.168.56.0/24 via 192.168.1.42

┌──(kali㉿kali)-[~] └─$ ping 192.168.56.10 PING 192.168.56.10 (192.168.56.10) 56(84) bytes of data. ^C --- 192.168.56.10 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 1006ms

┌──(kali㉿kali)-[~] └─$ ping 192.168.56.1 PING 192.168.56.1 (192.168.56.1) 56(84) bytes of data. 64 bytes from 192.168.56.1: icmp_seq=1 ttl=64 time=1.45 ms 64 bytes from 192.168.56.1: icmp_seq=2 ttl=64 time=1.54 ms ^C --- 192.168.56.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 1.449/1.494/1.540/0.045 ms

┌──(kali㉿kali)-[~] └─$ sudo ip route add 192.168.56.0/24 dev eth0 via 192.168.1.42 RTNETLINK answers: File exists

┌──(kali㉿kali)-[~] └─$ sudo ip route add 192.168.56.0/24 dev eth0 via 192.168.51.1 Error: Nexthop has invalid gateway.

┌──(kali㉿kali)-[~] └─$

chrisstigson commented 8 months ago

I solved it by installing OpenVPN Access Server and sharing the networks using NAT routing. Still not sure why it didn't work previously, but some setting must have been wrong in the Ubuntu server. image

lkarlslund commented 8 months ago

Not sure what's going on there, but if you can ping everything 192.168.56.0/24 from your VirtualBox host (192.168.1.42), but not from outside the host, then it sounds like a routing thing.

IP routing is enabled by the script:

# Enable IP forwarding on Ubuntu
if [ "`cat /proc/sys/net/ipv4/ip_forward`" != "1" ]; then
  # Implement in sysctl
  echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf
  sysctl -p
fi

What does "ip addr" output?

TamaGorengs commented 4 months ago

I have the same issue. But I can only ping 192.168.56.1. Other than that I can't reach it.