You are not logged in.

#1 2009-06-06 16:19:17

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

syntax of ip ranges in /etc/hosts.allow

How does one define a range of IP addresses in the /etc/hosts.allow?  Pasted from the ssh wiki article

# let everyone connect to you
sshd: ALL

# OR you can restrict it to a certain ip
sshd: 192.168.0.1

# OR restrict for an IP range
sshd: 10.0.0.0/255.255.255.0

# OR restrict for an IP match
sshd: 192.168.1.

If I just want 192.168.1.2 - 192.168.1.10 (inclusive), what would the syntax be for this?

192.168.1.2/192.168.1.10 didn't work for me.

Thanks.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2009-06-06 16:35:42

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: syntax of ip ranges in /etc/hosts.allow

`man 5 hosts_access` will tell you everything about the format of /etc/hosts.{allow,deny}


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2009-06-06 22:44:39

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: syntax of ip ranges in /etc/hosts.allow

You can't do this on a single line AFAIK since .2 to .10 doesn't fit in any valid CIDR mask. You will need to add a line for each host individually:

sshd: 192.168.1.2
sshd: 192.168.1.3
sshd: 192.168.1.4
sshd: 192.168.1.5
sshd: 192.168.1.6
sshd: 192.168.1.7
sshd: 192.168.1.8
sshd: 192.168.1.9
sshd: 192.168.1.10

Technically there are multiple /30 masks that fit within that, but you'd still have to have multiple lines.

Last edited by fukawi2 (2009-06-06 22:45:26)

Offline

Board footer

Powered by FluxBB