Chinaunix首页 | 论坛 | 博客
  • 博客访问: 906450
  • 博文数量: 75
  • 博客积分: 1216
  • 博客等级: 少尉
  • 技术积分: 1998
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-11 16:20
个人简介

优秀是一种习惯

文章分类

全部博文(75)

文章存档

2014年(1)

2013年(29)

2012年(45)

分类: LINUX

2012-10-07 10:26:19

iptables的OUTPUT 中做DNAT

[root@bakrouter ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:77:36:8F  
          inet addr:192.168.83.11  Bcast:192.168.83.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2781 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2042 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:241321 (235.6 KiB)  TX bytes:207224 (202.3 KiB)

[root@bakrouter ~]# ssh 192.168.83.10
root@192.168.83.10's password: 
Last login: Sun Oct  7 06:56:15 2012 from 192.168.83.1
[root@actrouter ~]# exit
logout
Connection to 192.168.83.10 closed.
[root@bakrouter ~]# iptables -t nat -A OUTPUT --destination 192.168.83.10 -p tcp --dport 22 -j DNAT --to-destination 192.168.83.12
[root@bakrouter ~]# ssh 192.168.83.10
root@192.168.83.10's password: 
Last login: Sun Oct  7 18:18:32 2012 from 192.168.83.11
[root@web1 ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:5A:A0:F0  
          inet addr:192.168.83.12  Bcast:192.168.83.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1010 errors:0 dropped:0 overruns:0 frame:0
          TX packets:562 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:76735 (74.9 KiB)  TX bytes:56420 (55.0 KiB)

[root@web1 ~]# exit
logout
Connection to 192.168.83.10 closed.
阅读(3656) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~