What's new

Setting IP addresses for two interfaces on the same physical port

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

OzTm

New Around Here
Hello everyone!

I recently bought a RT-AC66U, and instead of using firmware that I'm familiar with, like stock or Open/DD-WRT, I decided to try Merlin on it.
So far it seems awesome, everything runs great and I'm happy with all its features.

However, I ran into a problem when I tried to set up two the interfaces on the same cable. What I would like to obtain is something like this:

Internet (external IP) <--- (ppp0 interface on WAN port) ---> ASUS RT-AC66U <--(br0 if/LAN1 port)-> LAN PC (192.168.3.2)
..........................................................|
Local device (192.168.1.10) <--- (eth0 if on WAN port) ---^



So I connect to the Internet through PPPoE (upper branch), over the WAN physical port. This is creating the interface called ppp0 in ifconfig, working fine with DHCP.
But I would also like to access a local device connected on the same WAN physical port (lower branch), for which I need to set a static IP so it doesn't run through the PPPoE tunnel.

If I choose the Static IP settings from the UI, I can set a 192.168.1.x IP address, and this properly assigns that address to the eth0 interface, and I can communicate with the "outer" local device from inside the LAN (192.168.3.x).
But when I choose PPPoE from the UI, I can't connect to it anymore. Running ifconfing shows that the ppp0 gets an IP address, the Internet is working, but the eth0 interface loses the 192.168.1.1 address, and instead uses 169.254.230.58.

I have enabled SSH, but I haven't yet been able to identify the network configuration files.
I was meaning to attempt using nano to set something like:
iface eth0 inet static
address 192.168.1.1


Can anyone please give me a hint on what to try next?
Thanks
 
I have similar to access the maintenance IP on my modem...

admin@JDBRouter:/tmp/home/root# cat /jffs/scripts/services-start
#!/bin/sh

ifconfig eth0:1 10.11.20.254 netmask 255.255.255.0
iptables -t nat -I POSTROUTING ! -s $(nvram get lan_ipaddr) -d 10.11.20.0/24 -j SNAT --to 10.11.20.254
logger Set routing to BT Openreach Modem



Sent from my iPhone using Tapatalk
 
So anything in 10.11.20.0/24 plugged into the WAN side is now routable from my LAN. You put 192.168.1.0/24 in the iptables rule and 192.168.1.254 in the ifconfig rule you should be able to access 192.168.1.1


Sent from my iPhone using Tapatalk
 
So anything in 10.11.20.0/24 plugged into the WAN side is now routable from my LAN. You put 192.168.1.0/24 in the iptables rule and 192.168.1.254 in the ifconfig rule you should be able to access 192.168.1.1

Hey, thank you for the quick reply and your help. What you're describing seems to perfectly apply to my situation.
I tried your advice, but it's still not working. The /jffs/scripts/ directory was there, but no services-start file.
I did nano services-start, which created it. Seeing it had no effect, I tried:
chmod +x /jffs/scripts/services-start

Ifconfig still shows 169.254.230.58 as my eth0 IP address, and I still can't ping the Wan device.

Do I have to somehow enable the services-start script file? Or is this setting overwritten at a later time? From what I understand, you are logging a message in this script (last line). Where can I check that?

Thank you.
 
Hi.

In the WebUI there is an option to enable jffs and another to format it on next boot. I’d suggest checking them both and rebooting so we are at a good starting point.

Then create the script and make it executable as you already did and reboot again.

If it works you’ll see that logging msg in the System Log>General in the WebUI as well as a new interface eth0:1 in ifconfig.

You can also run the script manually of course to test (rather than reboot). Or indeed run the 2 commands manually as well.

Finally, I forgot to explicitly mention but I assume you worked out, the iptables line has two mentions of my example IP/Subnet, you’ll need to change both.

Hope one of these gets you going!

Post the content of your script otherwise.


Sent from my iPhone using Tapatalk
 
Hello again.

Foolishly enough I didn't realise that you could run the script or even the commands manually :)
When I tried that, iptables gave me an error which prompted me to edit the file, and it seems I somehow pressed Enter by mistake, because I had a newline in the middle of that command... I removed that, ran the script again and it worked. Again, silly me... :)

I didn't reboot the router yet to see if it auto-runs or not, but that wouldn't even bother me that much, considering that I need access to that device only once in a very long time, so I could just run the script when I need it.

Thank you very much for taking the time to help me with this issue. Have a great day/evening!
 
  • Like
Reactions: JDB
Not a problem. Glad to be of service [emoji106]


Sent from my iPhone using Tapatalk
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top