免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 5694 | 回复: 29
打印 上一主题 下一主题

[OpenBSD] 谁成功的在OpenBSD上绑定MAC和IP的对应关系 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-10 09:27 |只看该作者 |倒序浏览
我现在的网络是这样的;:
rl0:内网
rl1:外网
内网部分用户通过PF的NAT实现代理上网
但是总是有个别人冒用他人的ip上网
我用arp -s 绑定mac 无效
谁有类似的成功经验 希望能够指导一下

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
2 [报告]
发表于 2005-12-10 09:28 |只看该作者
怎么会没效?

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
3 [报告]
发表于 2005-12-10 09:34 |只看该作者
1.
arp -s 192.168.1.112   xx:xx:xx:xx:xx:xx       permanent

2.
在PF里,只让指IP通过就行.

[ 本帖最后由 congli 于 2005-12-10 09:35 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2005-12-10 10:08 |只看该作者
这个方法我试验过了  arp命令执行没有问题 但是客户端改ip后 还是可以通过  查看arp信息 设置已经改变了

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
5 [报告]
发表于 2005-12-10 10:19 |只看该作者
把pf.conf贴出来看看.

论坛徽章:
0
6 [报告]
发表于 2005-12-10 10:29 |只看该作者
#       $OpenBSD: pf.conf,v 1.28 2004/04/29 21:03:09 frantzen Exp $
#
# See pf.conf(5) and /usr/share/pf for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.

ext_if="tun0"
int_if="rl0"
ext_net="rl1"
modem="192.168.42.254"
lan_net="192.168.1.0/24"
Admin="{192.168.1.25,192.168.1.15,192.168.1.254}"
ports="{80,443,110,25,1863}"
smsport="{9900,9901,9902,22223}"
smshost="{192.168.1.103}"

# --- Define Table
table <leader> persist file "/etc/leader_user"
table <software> persist file "/etc/software_user"
table <message> persist file "/etc/message.block"
table <other> persist file "/etc/other.block"
table <working> persist file "/etc/working_user"
table <test> persist file "/etc/test_user"

# --- Option
set block-policy drop
set loginterface $ext_if
scrub in all

# --- NAT
nat on $ext_if from $Admin  -> ($ext_if:0)
nat on $ext_if from <software> -> ($ext_if:0)
nat on $ext_if inet proto tcp from <leader> to any port $ports  -> ($ext_if:0)
nat on $ext_if inet proto udp from <leader> to any port = 53 -> ($ext_if:0)
nat on $ext_if inet proto icmp from <leader> to any -> ($ext_if:0)
nat on $ext_if inet proto udp from <working> to any port = 53 -> ($ext_if:0)
nat on $ext_if inet proto icmp from <working> to any -> ($ext_if:0)
nat on $ext_if inet proto tcp from $smshost to any port $smsport ->($ext_if:0)

# --- Redirection
rdr on $ext_if proto tcp from any to $ext_if  port 80 -> 192.168.1.3 port 80
rdr on $int_if proto tcp from $Admin to $int_if port 8888 -> $modem port 80

#rdr on $ext_if proto tcp from any to $ext_if port 4662 -> 192.168.1.15 port 4662
#rdr on $ext_if proto udp from any to $ext_if port 4672 -> 192.168.1.15 port 4672

rdr on $int_if proto tcp from $Admin to any port 21  -> 127.0.0.1 port 8021
rdr on $int_if proto tcp from <software> to any port 21  -> 127.0.0.1 port 8021
rdr on $int_if proto tcp from <working> to any port 80  -> 192.168.1.1  port 8025


# --- Block All
block out  on $ext_if from $lan_net to any
block in on $ext_if from any to $lan_net
block out  on $ext_net from $lan_net to any
block in on $ext_net from any to $lan_net
pass quick on lo0 all

# ---- lele8
pass in on $ext_if proto tcp from any to 192.168.1.3 port 80 keep state
pass in on $ext_if proto tcp from any to 192.168.1.15 port 4662 keep state
pass in on $ext_if proto udp from any to 192.168.1.15 port 4672 keep state

# ---- Manager SSH
block  in  on $int_if  proto tcp  from $lan_net to $int_if port 22
pass   in  on $int_if  proto tcp  from $Admin   to $int_if port 22 keep state

# ---- Manager SNMP
block  in  on $int_if  proto udp  from $lan_net to $int_if port 161
pass   in  on $int_if  proto udp  from $Admin   to $int_if port 161 keep state


# --- Pass Administrator
pass out on  $ext_if from $Admin to any keep state
pass in on $ext_if proto tcp from any to $modem port 80 keep state

# --- Pass Table <software>
pass out on  $ext_if from <software> to any keep state

# --- Pass Table <leader>
block out  quick on $ext_if from <leader> to any
pass  out on  $ext_if proto tcp from <leader> to any port $ports  keep state
block on $ext_if from <leader> to <message>
block on $ext_if from <leader> to <other>
block on $int_if from <leader> to <message>
block on $int_if from <leader> to <other>

# --- Pass SMS
pass  out on  $ext_if proto tcp from $smshost to any port $smsport  keep state

# --- Test
block out  quick on $ext_if from <working> to any
pass  out  on  $ext_if proto tcp from <working> to any port $ports  keep state

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
7 [报告]
发表于 2005-12-10 10:44 |只看该作者
顺手把拓扑图也画一下.

论坛徽章:
0
8 [报告]
发表于 2005-12-10 10:56 |只看该作者
很简单的网络结构呀

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
9 [报告]
发表于 2005-12-10 11:06 |只看该作者
那就建议你用最简单的规则来测试.在你的规则里有不少问题.

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
10 [报告]
发表于 2005-12-10 11:10 |只看该作者
随便找两处:
# --- Pass Table <leader>
block out  quick on $ext_if from <leader> to any
pass  out on  $ext_if proto tcp from <leader> to any port $ports  keep state

# --- Test
block out  quick on $ext_if from <working> to any
pass  out  on  $ext_if proto tcp from <working> to any port $ports  keep state
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP