My OpenWrt router doesn't get ip from cablemodem

Hello,
I have a network setup with 3 wan connections, 2 ADSL and 1 using a cablemodem, using mwan3 both wan1 and wan2 loadbalance fine, but the cablemodem does not provide an ip to my WAN, I tried connecting this cable modem to any of my 2 remaining wan ports and it stills without IP, the only way that I found to get a temporary IP is connecting first the cablemodem to a windows computer and then connecting it to my wan port, spoofing the mac of my computer, that way the router gets ip and internet access for a while.

My cablemodem is a motorola SB510, my router is a TP-LINK WR940N V4.

There's some of my settings:

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'
        option metric '10'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option vid '1'
        option ports '1 4 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option vid '2'
        option ports '2 0t'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option vid '3'
        option ports '3 0t'

config interface 'wan2'
        option ifname 'eth1.2'
        option proto 'static'
        option ipaddr '192.168.0.200'
        option netmask '255.255.255.0'
        option gateway '192.168.0.1'
        option dns '8.8.8.8 200.44.32.12'
        option metric '20'

config interface 'wan3'
        option ifname 'eth1.3'
        option proto 'dhcp'
        option metric '30'
        option macaddr '**:**:**:**:**:**'
        #option broadcast '1'
        #option force_link '1'

Wan3 is the one that I'm trying to use, that 2 commented lines doesn't work for me, however the cablemodem does not provide IP on any of the wan ports, on maccaddr option there's the ip of the computer that works with the cablemodem.

part of ifconfig output:


eth0      Link encap:Ethernet  HWaddr *:*:*:*:*:*B
          inet addr:186.90.***.*** Bcast:186.90.***.*** Mask:255.255.224.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:90731 errors:0 dropped:0 overruns:0 frame:0
          TX packets:70595 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:101785534 (97.0 MiB)  TX bytes:11636560 (11.0 MiB)
          Interrupt:4

eth1.2    Link encap:Ethernet  HWaddr *:*:*:*:*:*A
          inet addr:192.168.0.200  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23021 errors:0 dropped:21 overruns:0 frame:0
          TX packets:19671 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:17517030 (16.7 MiB)  TX bytes:2988831 (2.8 MiB)

eth1.3    Link encap:Ethernet  HWaddr **:**:**:**:**:**
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:919 errors:0 dropped:390 overruns:0 frame:0
          TX packets:345 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:178417 (174.2 KiB)  TX bytes:116958 (114.2 KiB)

An important thing is that the cablemodem interface responds to ping at lan at any time (192.168.100.1), but internet just works in the windows computer or any device other than my router-

root@OpenWrt:~# ping -Ieth1.3 192.168.100.1
PING 192.168.100.1 (192.168.100.1): 56 data bytes
64 bytes from 192.168.100.1: seq=1 ttl=64 time=1.884 ms
64 bytes from 192.168.100.1: seq=2 ttl=64 time=1.923 ms
64 bytes from 192.168.100.1: seq=3 ttl=64 time=3.568 ms
64 bytes from 192.168.100.1: seq=4 ttl=64 time=2.049 ms

Thank you for reading my issue.

Try rebooting the cable modem and the router (without the MAC of the windows host). In DOCSIS provisioning, the modem will only give DHCP addresses for a short time after booting up, so rebooting the modem often helps with situations like yours.

2 Likes

Thanks for you reply, I read something about that, I tried again and it doesn't work for me, there's some way to force this dhcp between the router and the cablemodem?

Not that I know of, except by rebooting. Itight not actually help, but in your position I would retry the boot everything again, except I would power down the modem for 10-15 minutes to allow the cmts to recognize, that the modem "left the building". Again, probably not a solution, but cheap/easy enough to try....

Good luck.

1 Like

Comcrap, at least, is “sticky”. Try powering down the modem for a few minutes, then it might be more cooperative.

1 Like

Both of you gave me the correct answer, since my router is connected to a switch where lan and wan are together, some of my non static ip devices in wireless where asking the cablemodem for dhcp before the router itself. To solve this problem I had to put an old additional router in between and it works ok now, since the only device asking the cablemodem for IP is the additional router. Thanks

Are you not able to connect the modem directly to the WAN port of the main router bypassing the switch.

Puzzled you didn't mention the switch earlier

1 Like

My bad not mentioning the switch earlier, that's kind of tricky, because I would need to run a new long cable between my router and my cablemodem.

Use a RJ45 Cat6 coupler to join the cables into one long cable

2 Likes

+1, with decent (aka standard compliant) cables Ethernet allows segments of up to 100 m, so just linking two shorter cables will most likely work well, unless you are pushing against the 100m limit or the cables and/or the coupler are faulty.

Good luck!

2 Likes

Thank you, actually I need to add a brand new cable, because I need 2 cables running in the wall, because my cablemodem is next to a DVR who needs a cable as well, that’s the reason why I’m using 2 switches, one in the cablemodem/DVR side and another on the router side, in the router side one cable connects from the switch to LAN port and the other to WAN, all static ip’s in order to avoid the router give ip to itself via dhcp, but that’s slowing down my network, lot of packet lost, I’m seriously considering adding that additional cable.

1 Like

Can you post a diagram of how the router, cable modem and switches are connected and the main devices on your network. Labeling wan and lan ports for clarity.

2 Likes

You should be able to run things over a single cable as long as you use VLAN tags to properly separate the two logical links. In that case you need a managed switch on the side of the cable modem and DVR, which wraps packets from each device into different VLANs. On the other end your OpenWrt router should be sufficient to deal with the two VLANs without requiring another switch. Personally, I would prefer to have separate cables and to avoid the VLAN hassle, but reality being what it is, sometimes VLANs are less hassle than the alternative like a new/additional cable run.

1 Like

That's it, ethernet cables denoted with blue color. I'm sorry for my poor drawing skills :joy:


With this setup my lan becomes a bit unstable, specially with wired devices, and isn't related to resources issues, because my CPU is 90% idle almost all the time, and I have about of 7 MB - 9MB of available RAM

Thank you, actually that's an excellent idea, I didn't know that this type of switch existed, but I check in Amazon and it seems some expensive (about 30$ the cheapest one), so I think the best option for me is put some effort in adding a new cable for my setup, fully dedicated to my wan connection, that way I will eliminate a lot of additional devices and cables (the two switches and that old router). However I will consider that option too, seems to be quite useful.

2 Likes

I fully understand, and would prefer the new cable run option myself. That said, the old router with static IP might contain a switch that allows to configure VLANs....

2 Likes

Hello, I'm extending this topic a bit asking for a little help about the same thing, I had an idea in order to preserve this same setup avoiding the unmanaged switches, I connected my DVR to the old router using in the settings the gateway of my main router (192.168.1.1), but I have a problem, since my old router is connected to a vlan port, my other devices are not able to see my DVR. So the question is, how can I set a bridge between my old router LAN connected to the vlan ethernet port (static at 192.168.254.1) and my main LAN in order to activate my DVR using the subnet of my main router?.

There's the interface where my DVR is connected using IP 192.168.1.200, can I make some sort of filtering or bridge in order to my router knows there's my device?:

config interface 'wan3'
        option ifname 'eth1.3'
        option proto 'static'
        option ipaddr '192.168.254.200'
        option netmask '255.255.255.0'
        option gateway '192.168.254.1'
        option dns '8.8.8.8 8.8.4.4'
        option metric '30'

Update: I created a new interface this way:

config interface 'dmz'
        option ifname '@wan3'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'

And now my lan detects my DVR (IP 192.168.2.200), using this firewall setup: (Irrelevant parts are hidden)

config zone
        option name             dmz
        list   network          'dmz'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

config forwarding
        option src              lan
        option dest             wan

config forwarding
        option src              wan
        option dest             dmz

config forwarding
        option src              lan
        option dest             dmz

config forwarding
        option src              dmz
        option dest             lan

config rule
        option name             Allow-IPSec-ESP
        option src              wan
        option dest             lan
        option proto            esp
        option target           ACCEPT

config rule
        option name             Allow-IPSec-ESP
        option src              wan
        option dest             dmz
        option proto            esp
        option target           ACCEPT

config rule
        option name             Allow-ISAKMP
        option src              wan
        option dest             lan
        option dest_port        500
        option proto            udp
        option target           ACCEPT

        option name             Allow-ISAKMP
        option src              wan
        option dest             dmz
        option dest_port        500
        option proto            udp
        option target           ACCEPT


config redirect
        option target 'DNAT'
        option src 'wan'
        option dest 'dmz'
        option proto 'tcp udp'
        option dest_ip '192.168.2.200'
        option name 'ALL->DMZ'

However even when my lan detects my device and I'm able to watch my CCTV locally, my DVR cannot get to the internet.

Definitive solution: splitting ethernet cable in two, using 2 pairs for each crimp, that way the cable goes to two different ports at the router (LAN AND WAN) and in the devices side it goes on the DVR and in the cablemodem.

I thought you were trolling until I realized you were the OP. Can you more clearly explain what this means; and how it solved your issue?

  • Are you saying that your issue was solved by constructing a cable not wired to the TIA/EIA-568 standard?
1 Like