由 Snoopy 在 03-23-2003 12:25 发表:
怎么关掉这个ip段对我的访问?
是不是iptables这个命令就可以解决???
我的ip是192.168.112.88,我想除了166可以访问我,
其他的都访问不了,,,请问怎么弄啊???谢谢
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 BTworm 在 03-23-2003 21:46 发表:
假设你的网络掩码(netmask)是255.255.255.0
iptables -A INPUT -s 192.168.112.166 -j ACCEPT
iptables -A INPUT -s 192.168.122.0/24 -j DROP
上面的两行保证在192.168.112.0/24网段中只有192.168.112.166可以访问,不知你想要的是不是这个。
由 Snoopy 在 03-23-2003 22:13 发表:
是的,谢谢,,,
你后面的/24是什么意思可以解释一下吗???
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 BTworm 在 03-23-2003 22:57 发表:
/24就是指网络掩码255.255.255.0。十进制的255相当与二进制的11111111,8位;所以255.255.255.0,C类网掩码,就是/24。同理可推论A类网为/8,B类为/16。当然上述都是标准的网络分割方式,如果是不标准的,就有可能出现/25,/17等情况。
如果我说得不对,可一定告诉我呀。
由 若飞 在 03-24-2003 08:37 发表:
如果
如果我的IP掩码是255.255.255.72呢,在那里应该怎么设呢?
授人以鱼,不如授人以渔。
由 BTworm 在 03-24-2003 08:58 发表:
> quote: > > * * * > > 如果我的IP掩码是255.255.255.72呢,在那里应该怎么设呢? > > * * *
255.255.255.72换算成二进制就是 11111111 11111111 11111111 01000100.这样的掩码我从来没见过,算非标中的非标了吧.兄弟你真把我难住了!
由 Snoopy 在 03-24-2003 12:39 发表:
那如果我想禁止192.168.后面所有ip对我的访问是不是16?
iptables -A INPUT -s 192.168.0.0/16 -j DROP
这样对不对??
禁止192.后面所有ip对我的访问,是不是8?
iptables -A INPUT -s 192.0.0.0/8 -j ACCEPT
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 BTworm 在 03-24-2003 12:56 发表:
> quote:
>
> * * *
>
> 禁止192.后面所有ip对我的访问,是不是8?
>
>
>
> iptables -A INPUT -s 192.0.0.0/8 -j ACCEPT
>
> * * *
我想你是想说: iptables -A INPUT -s 192.0.0.0/8 -j DROP
从语法上讲,你的两条命令是没错的.但第二条,实际上不会这么用.
因为192.xxx.xxx.xxx是B类网,如果你用A类网的掩码(/8,或255.0.0.0),就同屏蔽到了256个网络(从192.0.xxx.xxx到192.255.xxx.xxx).除非你100%肯定你不想和上述256个网络里的任何主机通讯,否则这么做就是不对的.
由 Snoopy 在 03-24-2003 17:23 发表:
那比如我开http,别人浏览网页是通过80
有办法将在80端口接收的数据转到8端口去吗????
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 BTworm 在 03-25-2003 11:21 发表:
> quote:
>
> * * *
>
> 那比如我开http,别人浏览网页是通过80
>
>
>
> 有办法将在80端口接收的数据转到8端口去吗????
>
> * * *
当然是可以的!
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8
由 Snoopy 在 03-25-2003 12:40 发表:
[root@Snoopy root]# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8
[root@Snoopy root]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
为什么从中看不出来呢??
还有一个问题是,,可不可以将多个端口转到一个端口上?
或是一个端口转到多个端口去??
比如我开ftp,21,http80,我想两个都用同一端口1026
或是将80端口转到1027和1028上,???可以的吗??
可以告诉我怎么弄吗?iptables的文章我看不懂,我需要例子才能
慢慢看得懂,麻烦你了 ~~~
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 BTworm 在 03-25-2003 13:02 发表:
用iptables -L -t nat 可以看到。
多对多是肯定可以的,但一对多和多对一好象没什么意义。
> quote: > > * * * > > 比如我开ftp,21,http80,我想两个都用同一端口1026 > > * * *
当请求发到1026时,你怎么判断是什么请求呢?
> quote: > > * * * > > 或是将80端口转到1027和1028上,???可以的吗?? > > * * *
那就要开两个HTTP的守护进程,这样做有什么意义吗?
很喜欢和你讨论,你的问题挺有意思。
由 Snoopy 在 03-25-2003 13:21 发表:
我的qq622556,msn:[email protected]
我们交流一下,,,,
其实我问到底,想实现的就是,我机开只开80端口
我想别人扫我机的端口时,显示全部端口都打开,其实相应端口的服
务是没有开的,,,上次我听网友说可以用iptables实现,,,,,
是不是有什么重定向什么的?可以将数据发到一个端口上???
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 BTworm 在 03-26-2003 09:29 发表:
我想,你是在考虑安全问题吧。
把所有的端口都关掉是可以的,而