I have several interfaces but i need to make all the requests from LAN network go through other gataway not the one that goes throug WAN ?
i tried via luci but nothig changed
do i have to wright a rule like all from LAN def gw 192.168.0.1 or thre is an other way to do so ?(192.168.0.1 is reacheble even can do nslookup )
maybe like this ?
root@my:~# cat /etc/config/firewall
config defaults
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
list network 'wan'
list network 'wwan'
config rule
option name 'WG'
list proto 'udp'
option src 'wan'
option dest_port '0000'
option target 'ACCEPT'
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option dest 'lan'
option proto 'esp'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Allow-ISAKMP'
option src 'wan'
option dest 'lan'
option dest_port '500'
option proto 'udp'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'Support-UDP-Traceroute'
option src 'wan'
option dest_port '33434:33689'
option proto 'udp'
option family 'ipv4'
option target 'REJECT'
option enabled '0'
config include
option path '/etc/firewall.user'
config zone
option name 'VPN'
option output 'ACCEPT'
option forward 'REJECT'
option input 'REJECT'
list network 'vpn'
config rule
option name 'Iperf3'
option src 'wan'
option dest_port '0000'
option target 'ACCEPT'
option enabled '0'
config zone
option name 'videonet'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network '249'
config forwarding
option src 'videonet'
option dest 'wan'
config zone
option name 'wgcli'
option output 'ACCEPT'
list network 'wgcli'
option forward 'ACCEPT'
option input 'REJECT'
config forwarding
option src 'lan'
option dest 'wgcli'
config forwarding
option src 'lan'
option dest 'wan'
config forwarding
option src 'lan'
option dest 'VPN'
config forwarding
option src 'lan'
option dest 'videonet'
i just need all the request from 192.168.222.0/24 go to 192.168.0.1 which goes trough WG tunnel
BTW nothing chnaged in route table after a added route via luci
But why shoud I point to wg interface if route knows there 192.168.0.0/24 exactly is? And this wgcli does not have any gw except default which is local
Because 192.168.0.0/24 isn't directly attached to the router.
But I realized I made 2 mistakes... 1) the route should not include the /32. That was just because I copied the address from the WG stanza and forgot to strip off the subnet mask. and 2) the destination should actually be the router at the other end of the tunnel... I'm going to guess that it is 10.197.197.1. This should accomplish the goal because the router has an address on that network and knows how to send traffic to another host on that network directly.
However, there are a few things you should change...
Make the interface address a /24:
config interface 'wgcli'
option proto 'wireguard'
option private_key 'ABt8BmYqPj2M='
list addresses '10.197.197.2/24'
And then, we're going to make the allowed_ips 0.0.0.0/0 so that all IP addresses can go through the tunnel. But... to make sure this doesn't clobber your routing table, we'll also take out the option to route_allowed_ips. You can remove all the 10.197.197.x and 192.168.0.0/24 allowed IPs:
but if i route_allowed_ips all goes via 10.197.197.1 exept WG connection(which is good) so thre is no way i can make only LAN go outside via remote host (10.197.197.1)
Ok... so... it seems you have a 2 local networks, a single 'regular' wan, and then 2 VPNs. Can you describe your goals for each of the networks and VPNs?
First lets forget about VPN interface it is not important RN i am talking about only wgcli interface.
I thought it is posible to route all requests from LAN (192.168.222.0/24) to remote WG interface (10.197.197.1) but every other interfaces will have default route via my local wan connection .
Theretically it is posible : i remove route_allowed_ips so default gateway stays usual(my local wan) but all from LAN goes via wgcli to remote router (10.197.197.1). But fro some reason there is nothing about LAN goes via 10.1979.197.1 in route table even though i added route in network config
i am filling like maybe some masquared can help
Also i am starting to think there can not be two lines in route table like
0.0.0.0/0 anyway so it is not the route shoud do but rather iptables or somthing like that