# Gateway troubleshooting



## nabaturov (Nov 3, 2019)

Hello, having troubles with gateway setup
`ifconfig -nr4`

```
Internet:
Destination    Gateway    Flags    Netif
default    10.0.0.1    UGS    re0
10.0.0.0/16    link#1    U    re0
192.168.2.0/24    link#2    U    ue0
192.168.2.1        link#2    UHS    lo0
```

First interface is a WAN connection
On a second interface is Windows machine which has troubles reaching anything
`tcpdump -ni ue0`

```
IP 192.168.2.2.58888 > 8.8.8.8.53 4864+ A? login.live.com
```

Where to dig, would be grateful for hints


----------



## Emrion (Nov 3, 2019)

Look at the handbook: https://www.freebsd.org/doc/handbook/network-routing.html


----------



## nabaturov (Nov 3, 2019)

Emrion said:


> Look at the handbook: https://www.freebsd.org/doc/handbook/network-routing.html


This is the guide I've used but still unable to reach any host from inside interface


----------



## Emrion (Nov 3, 2019)

Did you do that?


> In order for the system to forward packets between interfaces, FreeBSD must be configured as a router. Internet standards and good engineering practice prevent the FreeBSD Project from enabling this feature by default, but it can be configured to start at boot by adding this line to /etc/rc.conf:
> gateway_enable="YES"          # Set to YES if this host will be a gateway
> 
> To enable routing now, set the sysctl(8) variable net.inet.ip.forwarding to 1. To stop routing, reset this variable to 0.


----------



## nabaturov (Nov 3, 2019)

Emrion said:


> Did you do that?


Sure,
rc.conf

```
ifconfig_ue0="inet 192.168.2.1 netmask 255.255.255.0"
sshd_enable="NO"
firewall_enable="NO"
gateway_enable="YES"
```


----------



## SirDice (Nov 4, 2019)

Does the gateway at 10.0.0.1 have a route back to 192.168.2.0/24? It's going to need a static route. Running tcpdump(1) on ue0 will probably show packets going out but never receiving a response.


----------



## nabaturov (Nov 4, 2019)

SirDice said:


> Does the gateway at 10.0.0.1 have a route back to 192.168.2.0/24? It's going to need a static route. Running tcpdump(1) on ue0 will probably show packets going out but never receiving a response.


Looks like it have, when I try `route add -net 192.168.2.0/24 10.0.0.1` I have "route already in table" response
edit: I guess it's correct that I need a route back, traceroute from 192.168.2.2 machine shows
`traceroute 8.8.8.8`

```
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 _gateway (192.168.2.1) 0.2ms
2 ***
etc
```
But how to do that I don't know yet


----------

