Block PORT in local network

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page 1, 2  Next
Author Message
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 0:10    Post subject: Block PORT in local network Reply with quote
Hello,

How can I disable PORT usage on one or more local networks (e.g. 192.168.1.1, 192.168.2.1 etc.)? I would like to disable port 80 21 and 23 for all devices and users (everyone) participating in network segments.
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Sun Jul 31, 2022 0:21    Post subject: Reply with quote
I presume you're referring to these input ports on the router itself on the LAN side.

Presumably you want at least the router admin to have access, don't you? And from which IP might that be?

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 0:38    Post subject: Reply with quote
I want no one on the network to have access to these ports, not even the administrator. Each network belongs to br0 the subnets can see each other's devices. I want no one to be able to telnet and ssh to their devices.
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Sun Jul 31, 2022 0:46    Post subject: Reply with quote
Add the following to the firewall script.

Code:
iptables -I INPUT -i br0 -p tcp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i br0 -p udp -m multiport --dport 21,23,80 -j REJECT

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 10:11    Post subject: Reply with quote
There are 4 networks. 192.168.2.1, 192.168.2.1, 192.168.3.1, 192.168.4.1. If a camera is connected to network 2 192.168.2.300, it is accessible from all networks, so if someone opens an SSH connection in the putty, they can reach it. I entered the code in Administration --> Commands console, but it didn't disable SSH, it still allows the connection.
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sun Jul 31, 2022 11:14    Post subject: Reply with quote
@eibgrad suggestion assumes br0 which is the only default bridge, if you have different setup you need to adjust accordingly to suit.

Perhaps you should show a screenshot of the Networking page and anything relating to your networks setup bridge wise.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 11:23    Post subject: Reply with quote
I attached my network settings
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 11:25    Post subject: Reply with quote
Default bridge
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sun Jul 31, 2022 11:27    Post subject: Reply with quote
So you need in principle

Code:
iptables -I INPUT -i br0 -p tcp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i br0 -p udp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i wlan0.1 -p tcp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i wlan0.1 -p udp -m multiport --dport 21,23,80 -j REJECT

Mind if you access the web interface via HTTP blocking port 80 will prevent you from accessing the interface via HTTP port 80 from anything under br0 (which includes eth1 and wlan0 and including wlan0.1

Code:
nvram show | grep http

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1928

PostPosted: Sun Jul 31, 2022 11:48    Post subject: Reply with quote
If you're trying to block access to IP cameras, that is a different set of rules. Also, to block access to the router webUI via any other interface that is connected to br0, you should use ebtables instead of iptables. The only requirement is insmod'ing the required ebtables kernel modules in your firewall script. It sounds like you want to block access to or from client devices. The picture is somewhat unclear now from the original premise.

Disable Wireless Access To WebUI not working

_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 11:56    Post subject: Reply with quote
"If you're trying to block access to IP cameras"
-> Yes, I want to disable it, but only ports 22 and 23. I want it to be accessible only through the web port 443 for all connected devices.

"Also, to block access to the router webUI via any other interface"
-> This was just an idea to force e.g. the web interface of the camera to load only via https.




Code:
iptables -I INPUT -i br0 -p tcp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i br0 -p udp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i wlan0.1 -p tcp -m multiport --dport 21,23,80 -j REJECT
iptables -I INPUT -i wlan0.1 -p udp -m multiport --dport 21,23,80 -j REJECT

-> I tried the code. I can still get the camera ip address via SSH with putty. 192.168.3.100
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sun Jul 31, 2022 12:04    Post subject: Reply with quote
Is there no way to disable SSH on the camera itself?
_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 12:05    Post subject: Reply with quote
I changed to the IPTABLE and got this error: "kernel doesen't support the ebtables".

What could be the problem?
lenovomen
DD-WRT Novice


Joined: 29 Jul 2022
Posts: 30

PostPosted: Sun Jul 31, 2022 12:06    Post subject: Reply with quote
"Is there no way to disable SSH on the camera itself?"
--> No, unfortunately it is not possible to disable that feature.
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1928

PostPosted: Sun Jul 31, 2022 12:14    Post subject: Reply with quote
You've been asked to give router and build information in at least one other thread. Not knowing what router you are using or build or kernel involved, it could be that either you didn't insmod the ebtables modules or that the kernel doesn't have any ebtables functionality compiled in or available. You have to insert the required ebtables modules, otherwise the rules do not work. They are not compiled into the kernel by default. Also, my recommendation is wired IP cameras with their own managed switch.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum