pfsense-vsphere0.png

 

安装pfsense

启动电源后出现欢迎界面,选择1.Boot pfSense [default],或等待几秒钟自动选择,进入如下界面:
pfsense-vsphere1.png

输入I,回车,然后是一个蓝屏,开始安装。

也可以什么都不用管,系统会一直启动从CD启动得到一个完整的pfSense系统,因为没有安装所以在屏幕下方会有一个选项99) Install pfSense to a hard drive, etc.,输入99同样会进入下面的安装操作系统的过程。
pfsense-vsphere2.png

一路保存默认:< Accept these Settings >  < Quick/Easy InStall >  erase all content < OK >  < Standard Kernel >  < Reboot >

重启后安装完成,断开CD介质。
pfsense-vsphere3.png
详见见官网文档 https://doc.pfsense.org/index.php/Installing_pfSense 

下面开始配置内外网接口。

分配接口

从上图可以看到系统默认将em0接口当做WAN(外网),em1当做LAN(内部局域网),但我们不确定em0就是在创建虚拟机时分配的外网接口,需要根据MAC地址判断。

选择1) Assgin Interfaces,回车
首先询问你是否设置VLAN(用于划分多个子局域网网),Do you want to set up VLANs now [y|n]?,否n:
pfsense-vsphere4.png
pfsense-vsphere4-1.png

分配IP

选择2) Set interfce(s) IP address
pfsense-vsphere5.png
先配置WAN的IP,禁用DHCP,配置地址172.29.88.230/24,网关172.29.88.1,禁用IPV6:
pfsense-vsphere5-1.png
再配置LAN,172.30.31.1/24,不配置网关:
pfsense-vsphere5-2.png
完成后会提示可以在浏览器打开http://172.30.31.1/,通过webConfigurator来操作pfSense。

已打通两端网络:

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 
sean@seanubt:~$ ssh admin@172.30.31.1 22
Password for admin@pfSense.domain:
*** Welcome to pfSense 2.2.2-RELEASE-pfSense (amd64) on pfSense ***
 
WAN (wan) -> em0 -> v4: 172.29.88.230/24
LAN (lan) -> em1 -> v4: 172.30.31.1/24
0) Logout (SSH only) 9) pfTop
1) Assign Interfaces 10) Filter Logs
2) Set interface(s) IP address 11) Restart webConfigurator
3) Reset webConfigurator password 12) pfSense Developer Shell
4) Reset to factory defaults 13) Upgrade from console
5) Reboot system 14) Disable Secure Shell (sshd)
6) Halt system 15) Restore recent configuration
7) Ping host 16) Restart PHP-FPM
8) Shell
 
 
7
 
 
Enter a host name or IP address: 172.29.88.56
 
PING 172.29.88.56 (172.29.88.56): 56 data bytes
64 bytes from 172.29.88.56: icmp_seq=0 ttl=64 time=1.406 ms
64 bytes from 172.29.88.56: icmp_seq=1 ttl=64 time=1.215 ms
64 bytes from 172.29.88.56: icmp_seq=2 ttl=64 time=0.480 ms
 
--- 172.29.88.56 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.480/1.034/1.406/0.399 ms
 
Press ENTER to continue.
 
*** Welcome to pfSense 2.2.2-RELEASE-pfSense (amd64) on pfSense ***
 
WAN (wan) -> em0 -> v4: 172.29.88.230/24
LAN (lan) -> em1 -> v4: 172.30.31.1/24
0) Logout (SSH only) 9) pfTop
1) Assign Interfaces 10) Filter Logs
2) Set interface(s) IP address 11) Restart webConfigurator
3) Reset webConfigurator password 12) pfSense Developer Shell
4) Reset to factory defaults 13) Upgrade from console
5) Reboot system 14) Disable Secure Shell (sshd)
6) Halt system 15) Restore recent configuration
7) Ping host 16) Restart PHP-FPM
8) Shell
 
 
8
 
ping 172.30.31.20
PING 172.30.31.20 (172.30.31.20): 56 data bytes
64 bytes from 172.30.31.20: icmp_seq=0 ttl=64 time=0.239 ms
64 bytes from 172.30.31.20: icmp_seq=1 ttl=64 time=0.211 ms

 

登录

172.30.31.1是内部局域网的IP,所以只能通过另一台lan上的服务器的浏览器访问:
pfsense-vsphere6.png
当然这样操作起来很不方便,,而且假如lan上的其它服务器都是linux而且没有图像界面,没办法使用webConfigurator了。端口转发似乎是一个比较好的方案:在某一台lan服务器上添加一个可以通过你的pc端访问的网卡(我这里的172.29.88.206,它的lan接口IP为172.30.31.20),然后使用rinetd工具转发到172.30.31.1。
这个方法似乎可选,但需要额外的设置:
pfsense-vsphere7.png

An HTTP_REFERER was detected other than what is defined in System -> Advanced (http://172.29.88.206:8008/index.php?logout). You can disable this check if needed in System -> Advanced -> Admin.

pfSense为了安全起见,不允许任何形式的转发来访问webConfigurator,根据你的需要决定是否关闭这个功能:System -> Advanced -> Admin,勾选Browser HTTP_REFERER enforcement -> Save -> Apply。
pfsense-vsphere8.png

登陆的用户名默认为admin/pfsense
pfsense-vsphere9.png

使用配置向导

前面是通过命令行的方法对接口和IP进行配置,也可以直接通过webGUI向导对WAN和LAN、网关等设置:System -> Setup Wizard,因为太过简单,就不贴图了。
在设置WAN接口时(Configure WAN Interface)注意两点:

  • Static IP Configuration 部分设置正确的IP和网关,否则会无法进出网络
  • RFC1918 Networks 默认是勾选的,这是为了避免WAN上也存在与LAN一样的网段。如果要允许wan的其他主机ping通该pfSense,则去掉勾

其它保持为空或默认值。

pfSense的NAT功能

即Port Forward,目的是为了WAN上的其他机器可以访问LAN内部的服务。
Friewall -> NAT
pfsense-vsphere10.png

端口映射分为单端口和范围端口。但端口容易理解,访问WAN 172.29.88.230:8000 的 数据包都转发到内部LAN 172.30.31.20:8000;范围端口是在 from m to n 的端口范围内的数据包都发送到内部IP的对应端口上,减少规则的数量。
pfsense-vsphere11.png
Save -> Apply Changes,与此同时pfSense会自动在防火墙里添加规则,Firewal -> Rules
pfsense-vsphere12.png

 

參考來源1 : http://seanlook.com/2015/04/23/pfsense-usage/
參考來源2 : http://www.360doc.com/content/16/1125/10/27498460_609365608.shtml

arrow
arrow
    全站熱搜

    忽倫 發表在 痞客邦 留言(0) 人氣()