Static IP to LAN ports - OpenWRT

2

1

I have TP-Link TL-WR841N router and I had install OpenWRT firmware on it.

I want to use it on a experimental project which requires me to set static IPs for LAN ports on router as mentioned in below list.

Physical LAN Port 1 -> 192.168.1.2

Physical LAN Port 2 -> 192.168.1.3

Physical LAN Port 3 -> 192.168.1.4

Physical LAN Port 4 -> 192.168.1.5

So, if any PC/Laptop connected to Physical LAN port 3 of router, will always get IP 192.168.1.4

I had tried to look in to the configuration files of dnsmasq (DHCP and DNS server) on router. but, couldn't figured out how to do it.

Any ideas ?

Thanks in advance.

Jaydeep Dhrangdhariya

Posted 2016-06-07T14:10:49.700

Reputation: 23

could you provide final config files ? i'm very much interested in this setup as well – y_nk – 2016-10-22T14:55:18.197

Answers

1

In the default configuration of OpenWRT, you have a single bridge that contains all the physical LAN ports. If you create different networks for each LAN port, you can setup dnsmasq separately for each network. You can then assign all the networks into the same firewall zone.

Remember though that nothing prevents you or someone else to plug another switch or hub to that physical port, so the safest choice is still to assign IP addresses based on the MAC addresses.

wigy

Posted 2016-06-07T14:10:49.700

Reputation: 375

Thanks. Creating different networks for each LAN port really helped ! – Jaydeep Dhrangdhariya – 2016-06-09T10:40:36.673

If you deem it helped you, feel free to upvote and/or accept it as an answer. ;) – wigy – 2016-06-09T13:17:38.150

Seems like this answer did not help you, because you did not upvote and/or acccept it... :) – wigy – 2016-06-27T10:21:26.803