# How I Had SSH Access But No Internet. Port forwarding 80 into server, cuts off the internet in server

### Before, Let's learn how to forward ports from your router to server and server to your websites

MikroTik Router's login page:

Go to : IP > Firewall > NAT

![](https://cdn.hashnode.com/uploads/covers/65cf0b043f77edd06a52edca/ecf643d7-e84c-4cd2-886d-f64d63914f40.png align="center")

### Things to remember while doing port forwarding:

1.  ### We need to write the rules for Firewall and NAT ( Network Address Transalation)
    
2.  ### NAT: is the rule we write for actual port forwarding. Listen to port 'x' in router and pass it to port 'y' in server.
    
3.  ### Firewall rule should be written to tell our router to allow all traffic on this port which we just opened.
    

### NAT rule, that forwards port 80 to 80:

![](https://cdn.hashnode.com/uploads/covers/65cf0b043f77edd06a52edca/1d88e205-fc53-4b64-9601-72a99b18e079.png align="center")

![](https://cdn.hashnode.com/uploads/covers/65cf0b043f77edd06a52edca/ac2eebf1-baec-4c22-a401-f50288948dda.png align="center")

In General tab ( the first image), write the port your router wants to open,  
In Action tab ( second image), write the port you want to forward to server.

### Since I was using tailscale to ssh the server ,

## Problem: When I port forward 80-80, there was no internet access to the internet.

When you install Tailscale, it tries to be helpful by managing your network settings. It does this by taking over your server’s **DNS (Domain Name System)**.

If you look at your `/etc/resolv.conf` file, you’ll see it has been hijacked:

```python

~$ cat /etc/resolv.conf
# resolv.conf(5) file generated by tailscale
# For more info, see https://tailscale.com/s/resolvconf-overwrite
# DO NOT EDIT THIS FILE BY HAND -- CHANGES WILL BE OVERWRITTEN
nameserver 100.100.100.100
search tail259a0b.ts.net
```

**The Conflict:** Tailscale points your server to `100.100.100.100`—its internal "MagicDNS" resolver. This is great for finding other machines on your private network (like `my-laptop.ts.net`), but if your Tailscale admin settings aren't configured with a "Global Nameserver," your server suddenly forgets how to find the real internet.

### The Solution:

To fix this, you need to give your server a "phonebook" it can actually read. We want to keep Tailscale for our SSH access but stop it from blocking the rest of the internet.

**Step 1: Tell Tailscale to Back Off** First, run this command to tell Tailscale to stop forcing its own DNS settings on the system:

<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text">tailscale up --accept-dns=false</div>
</div>

**Step 2: Manually Set Global Nameservers** Now, we edit the DNS configuration file. Open it with: `sudo nano /etc/resolv.conf`

Delete the internal Tailscale IP or move it to the bottom. Add the world-standard Google and Cloudflare DNS IPs at the very top:

```javascript
//new config
nameserver 8.8.8.8
nameserver 1.1.1.1
nameserver 100.100.100.100
search tail259a0b.ts.net
```

**Step 3: Test the Connection** Now, try to reach the outside world again: `ping google.com`

If you see bytes flying back, you’ve won. Your server can now see your private network via Tailscale **and** fetch your code from GitHub at the same time.
