Keep getting isp routers gateway on client PC

I see here: Keep getting isp routers gateway on client PC - #6 by ConfusedUser

Screenshot from 2020-05-02 12-43-27

Is the OP sure that 0 shouldn't be the CPU?

@ConfusedUser, please show the output of:

swconfig dev switch0 show

Thanks.

(I drew up a config; but not sure until we see the swconfig output)
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 '0t 3 2 1'

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

But in the default configuration it's port 5 tagged and the 0-3 untagged.
So 5 must be cpu, the question is which physical port is internal port 0.

1 Like

Gotcha! The OP just needs to ID the physical ports 1-4 on the outside case!

:+1:

(As you know, swconfig helps with that too.)

2 Likes

I was hoping OP would use the Luci Network/Switch page which is more failproof.

2 Likes

The numbers on the openwrt router does correspond with the Luci interface's numbering.

All this time i have been using the luci interface. The other way is too difficult.
It's just my first time with OpenWrt :wink:

@trendy , @mk24

The reason it's in port 2 right now is because i have it directly connected to my pc so i could actually access it.
When i put it in the WAN port directly to my PC, it doesn't give me an IP, which i hope is intended.

swconfig dev switch0 show:

root@OpenWrt:~# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
        ports: 0x003f
Port 0:
        pvid: 2
        link: port:0 link:down
Port 1:
        pvid: 1
        link: port:1 link:down
Port 2:
        pvid: 1
        link: port:2 link:up speed:100baseT full-duplex auto
Port 3:
        pvid: 1
        link: port:3 link:down
Port 4:
        pvid: 0
        link: port:4 link:down
Port 5:
        pvid: 0
        link: port:5 link:up speed:100baseT full-duplex
VLAN 1:
        ports: 1 2 3 5t
VLAN 2:
        ports: 0 5t
root@OpenWrt:~#

If I understand what you are saying, when you connect the port on the OpenWrt router that you have configured as a WAN port, you do not get an IP address on your computer. This is the correct and expected behavior. Note which port this is -- and connect your ISP modem to this port.

Connect your computer to another port on the router (the others should be your LAN. Your computer should get a DHCP issued address from the OpenWrt router -- verify the address you get and post it here (it should be something in the 192.168.1.0/24 network).

In LuCI, the main status page should have a section for "IPv4 upstream" -- you should hopefully see a valid IPv4 address from the ISP in that section. Please verify that (bonus -- you can give us the first two octets which will help us validate that it is working as expected while not revealing your complete address).

Don't move the cable from that port to your PC.
Plug the cable from the ISP router to one port and run the same command. You'll see the port link:up. If it is not Port 0 try another port.
You can do the same in Luci Network/Switch. Once you plug in the cable you'll see the port coming up.

@trendy
Alright, i think everything is working as intended now.
I keep getting the right config from the DHCP consistently.

Windows client ipv4: 100.74.0.116(Preferred)
The OpenWrt's ip is 100.74.1.1 , as i set it to be that.

I can see on the main page that all devices get DHCP leases in the 100.74.0.0/17 range. Will decreasing the subnet mask help on performance or should i just leave it that big?

Wait, what? Is this your lan configuration???

That is not an Rfc1918 address range. 10.74.0.0 would be a fine network range, but not 100.74.0.0.

How many devices do you have? While there is no real performance penalty, it is far easier to work with /24 networks for most normal networks.

2 Likes

uff i am dumb... i didn't think about it being 100.0 and not 10.0... i should probably change that.

I have 3-4 Windows Clients and 2-5 wifi devices coming and going, so /24 should suffice i'd think.

The /24 can accommodate 254 hosts, that is more than enough for a home subnet.
Technically you can use the 100.74.0.0/17. The address space 100.64.0.0/10 is reserved for cg-nat. But better stick to the 10.x.y.z addresses.

1 Like

cc: @psherman
I've changed it, and then i went to openwrt main page and saw this, which didn't look quite right.
Left side: WAN , Right side: LAN

That is right.
Remove the DNS from LAN. You should assign DNS on the interface where they are reachable from (in your case the wan).

1 Like

Let's take a look at your latest /etc/config/network file.

1 Like

@trendy : i am unsure on where to disable DNS for the LAN interface.

Here is the network configuration:

root@OpenWrt:/etc/config# cat network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd39:af24:529d::/48'

config interface 'lan'
        option proto 'static'
        option ip6assign '60'
        list dns '1.1.1.1'
        list dns '1.0.0.1'
        list dns '8.8.8.8'
        list dns '8.8.4.4'
        option ifname 'eth0.1'
        list ipaddr '10.74.1.1/24'
        option gateway '10.74.0.1'

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

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '5t 3 2 1'

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

config interface 'WAN'
        option ifname 'eth0.2'
        option proto 'dhcp'

root@OpenWrt:/etc/config#

It's a highly recommended practice to use all lowercase for interface names. (LuCI converts them to uppercase for display; it really shouldn't). If you have 'WAN' in /etc/config/network and 'wan' as the network name in the firewall zone, it will not work.

Put the DNS servers in in the wan interface config block. When you are troubleshooting network problems, try to simplify the configuration as much as possible, for example use the ISP's DNS received by DHCP instead of specifying others.

1 Like

As @mk24 noted, remove "List DNS" from lan - add them to wan. Simple.

config interface 'lan'
        option proto 'static'
        option ip6assign '60'
        option ifname 'eth0.1'
        list ipaddr '10.74.1.1/24'
        option gateway '10.74.0.1'

config interface 'WAN'
        option ifname 'eth0.2'
        option proto 'dhcp'
        option peerdns '0'
        option dns '1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4'
  • BTW, list dns was incorrect anyway.
  • Also, your gateway setting under lan seems incorrect too - I assumed your gateway was on wan

The lan definition is also incorrect as I don’t think you can use / notation in the config file.

There is also no need to put in the gateway (which was out of scope anyway).

Try this:

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option delegate '0'
        option ipaddr '10.74.1.1'