– -w 0:0: It gives the local and remote tun adapters a number, in this instance 0. – -o Tunnel=point-to-point: It creates a virtual interface – -C: compression, may improve performance, may degrade – -N: It instructs SSH not to execute a remote command Autossh ends here, and native SSH commands start next. – -o “ServerAliveCountMax 3″: It retries keepalive a maximum of 3 times. – -o “ServerAliveInterval 30”: It sends a keepalive every 30 seconds – -M 0: Don’t use it, it refers to monitoring the TCP port To do this, enter the command below: ssh-keygen -t rsa cat ~/.ssh/id_rsa.pub | ssh "mkdir -p ~/.ssh & cat > ~/.ssh/authorized_keys" Connecting the Tunnel on Ubuntu 20.04įirst, enter the following command from Ubuntu20.04Server-1: autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NTC -o Tunnel=point-to-point -w 0:0 12.0.0.2 & Lastly set up key authentication to log in as root to the server. In this step, install autossh tool that watches SSH sessions and restarts them if they die, by running the following command: sudo apt-get install autossh Restart your OpenSSH server using the command below: sudo systemctl restart sshd Now uncomment and change “ PermitRootLogin prohibit-password” to “ PermitRootLogin without-password” and “ PermitTunnel no” to “ PermitTunnel yes”. Open the following file with your desired text editor: sudo nano /etc/ssh/sshd_config You should log in as root from the client to create a TUN adapter. In the first step, install the OpenSSH server with the help of the following command: sudo apt-get install openssh-server In the last step, you will add static routes to allow Ubuntu20.04Server-4 to ping Ubuntu20.04Server-3 through the SSH tunnel. No problem traversing NAT for IP SSH tunnel. This tunnel goes through the NAT (PAT) set up on the Cisco router that connects Ubuntu20.04Server-1 to the Internet. The SSH tunnel will use the 10.0.0.0/30 network. ![]() Recommended Article: Install ClamAV antivirus on Linux Ubuntu Installing SSH VPN Tunnel on Ubuntu 20.04įirst, you will setup an IP SSH tunnel from Ubuntu20.04Server-1 on the left at private physical IP 192.168.0.2 to Ubuntu20.04Server-3 on the right with public physical IP 12.0.0.2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |