Static Route for special Devices!

Assume:

Router A:
Lan IP is 192.168.0.1/24
Wan is PPPoE
DHCP enable 192.168.0.100-150

Router B:
Lan IP is 192.168.0.2/24
Wan is PPPoE
DHCP disable

Then,
Client PC A get IP address by DHCP 192.168.0.100/24 Gateway 192.168.0.1 DNS 192.168.0.1
Client PC B get IP address by DHCP 192.168.0.101/24 Gateway 192.168.0.1 DNS 192.168.0.1

How to set a static route for Client PC B (only) to use Router B to access internet?

Thank you!

How is Router B connected to the network? Just connected to the switch?
What is the OS of PC B?

Basically you would change the default route for PC B.
E.g. for Linux
ip route del default
ip route add default via 192.168.0.2

If you want to make that automatic (controlled by the router) read up the DHCP Option (Option 3) page and assign it for the the PC B MAC Address

3 Likes

Thanks for your reply!

I add below in dhcp file:

config tag 'tag1'
	option dhcp_option '3,192.168.0.2'
        option dhcp_option '6,192.168.0.2'

config host
	option name '001'
	option mac '00:23:24:97:09:00'
	option ip '192.168.0.101'
	option tag 'tag1'

The Client PC get below (DHCP):
IP: 192.168.0.101
Mask :255.255.255.0
Gateway: 192.168.0.1
DNS: 192.168.0.2

Gateway still keep in 192.168.0.1, possible also change it to 192.168.0.2? Or it already works to use 192.168.0.2 to access internet in backend?
Thank you!

config tag 'tag1'
list dhcp_option '3,192.168.0.2'
list dhcp_option '6,192.168.0.2'
1 Like

Thank you for your reply!
It works but it showed gateway to user.
Possible make it in Static Routes table? A special Client IP access internet use special Gateway! Any options in Routes?

Think there are options 121 or 249 for that, but I haven't tried them.

What is the difference between a Default route compared to a route that sends all traffic to a specific IP?