本站教程收集整理的这篇文章主要介绍了vmware配置管理ubuntu环境,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。
ubuntu环境下系统开发
- 1.vmware安装
- 1.1网络配置:
- 2.ubuntu安装
- 3.配置管理
- 3.1系统配置
- 3.1.1 /etc/environment
- 3.1.2 /etc/profile
- 3.1.3 /etc/hosts
- 3.1.4 当前工作用户配置
- 3.2网络配置
- 3.2.1 /etc/network/interfaces
- 3.2.2网络配置命令
- 3.3路由配置
- 3.3.1路由表查看
- 3.3.2主机路由
- 3.3.3网络路由
- 3.3.4默认路由
- 3.3.5路由跟踪
- 3.3.6路由命令
- 4.ubuntu服务安装:
- 4.1 ssh server安装
- 4.2 TFTP server安装
- 4.3 samba 安装
- 5.系统管理:
- 6.虚拟专用网络服务器环境搭建
- 6.1 PPTP服务器配置
- 6.2 L2TP服务器配置
- 6.3 PPTP与L2TP区别
- 6.4 IPsec
- 6.5.虚拟专用网络客户端测试
- 7.ubuntu搭建路由
- 7.1模拟场景
- 7.2vmware配置过程
- 7.3测试验证
- 8.TCPDUMP抓包
- 9. Linux下配置vlan
1.vmware安装
1.1网络配置:
1)win8通过ADSL PPPoE拨号上网,(通过用户名及密码拨号完成)
2)在控制面板的网络连接里进入-〉宽带连接-〉属性-〉共享,internel连接共享
3)选用VMware Network Adapter VMnet8作为双网卡共享代理, 配置ip地址及DNS;
ipaddr=192.168.137.1
netmask=255.255.255.0
gateway=192.168.137.2
DNS可以根据PPPoE拨号得到的结果设置,具体用cmd〉ipconfig -all查看
4)在vmwre中进入edit-〉virtual network editor选择VMnet8(跟win8上的网络接口一致)配置为NAT模式
subnet IP=192.168.137.0,netmask=255.255.255.0
进入NAT SetTing配置gateway=192.168.137.2
5)宽带进行重新拨号,以重新生成win8刚才的配置。
6)进入ubuntu系统,配置网络接口通过dhcp方式获得地址
7)一切ok后,网络就可以通了,可以ping测试,或web上网。
2.ubuntu安装
3.配置管理
3.1系统配置
3.1.1 /etc/environment
系统环境变量管理,用户的环境变量配置在这里。
root@ubuntu-snmp:~# cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
3.1.2 /etc/profile
此文件为系统为每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集sHell的设置。
3.1.3 /etc/hosts
hosts文件是Linux系统上一个负责ip地址与域名快速解析的文件;hosts文件包含了ip地址与主机名之间的映射,还包括主机的别名。优先级:dns缓存 > hosts > dns服务。
root@ubuntu-snmp:/home/chenchao# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu-snmp
# The following lines are desirable for IPv6 capable hosts
::1 localhost iP6-localhost iP6-loopBACk
ff02::1 iP6-allnodes
ff02::2 iP6-allrouters
3.1.4 当前工作用户配置
在当前用户的工作目录(~/)下,用户登入时执行的配置文件,主要有以下:
~/.bashrc
~/.profile
~/.bash_logout
~/.bash_history
3.2网络配置
3.2.1 /etc/network/interfaces
所有的网络接口参数都在这里配置。
1)基本的接口配置如下:
root@ubuntu-snmp:/home/chenchao# cat /etc/network/interfaces
# The loopBACk network interface
auto lo //系统启动时自动配置该接口
iface lo inet loopBACk //将该接口设置成一个环回接口
# The priMary network interface
auto eth0 //系统启动时自动配置该接口
iface eth0 inet static //将该接口配置成静态IP
address 192.168.100.189
netmask 255.255.255.0
gateway 192.168.100.1
dns-nameservers 192.168.100.1
2)桥接路由配置如下:
root@ac:/home/admin# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more @R_671_4036@ion, seE interfaces(5).
source /etc/network/interfaces.d/*
# The loopBACk network interface
auto lo
iface lo inet loopBACk
# The priMary network interface
auto eth5
iface eth5 inet dhcp //该接口为WAN接口
iface eth0 inet manual //该接口配置为LAN接口
iface eth1 inet manual
iface eth2 inet manual
iface eth3 inet manual
iface eth4 inet manual
auto br0
iface br0 inet static
bridge_ports eth0 eth1 eth2 eth3 eth4 //配置桥接
address 192.168.100.1
broadcast 192.168.100.0
netmask 255.255.255.0
bridge_waitport 0 # no delay before a port becomes avaiable
bridge_fd 0 # no forWARDing delay
路由信息查看
root@ac:/home/admin# route
Kernel IP routIng table
DesTination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.10.1 0.0.0.0 UG 0 0 0 eth5
192.168.10.0 * 便宜香港vps 255.255.255.0 U 0 0 0 eth5
192.168.100.0 * 255.255.255.0 U 0 0 0 br0
结合上下文,eth5获取的IP为192.168.10.X,即WAN口使用DHCP获取网络信息。
3.2.2网络配置命令
1.配置IP地址:
#ifconfig eth0 10.10.10.10 netmask 255.255.255.0 up
2.增加一个IP地址:
#ifconfig eth0:0 192.168.1.100
#ip addr add 192.168.1.20/24 dev eth0
3.配置默认路由:
route add default gw 192.168.1.1
route del default gw 192.168.1.1
4.关闭IPv6功能:
配置文件添加:/etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
#sudo sysctl -p
3.3路由配置
3.3.1路由表查看
root@ac:/home/admin# route -n
Kernel IP routIng table
DesTination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eth5
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth5
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
root@ac:/home/admin# route
Kernel IP routIng table
DesTination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.10.1 0.0.0.0 UG 0 0 0 eth5
192.168.10.0 * 255.255.255.0 U 0 0 0 eth5
192.168.100.0 * 255.255.255.0 U 0 0 0 br0
各个字段含义:
字段 | 含义 |
---|---|
DesTination@H_772_231@ | 目标网络或目标主机,0.0.0.0时为default默认网关所有的数据都发到这个网关@H_772_231@ |
Gateway@H_772_231@ | 网关地址,0.0.0.0 表示当前记录对应的 DesTination 跟本机在同一个网段,通信时不需要经过网关@H_772_231@ |
Genmask@H_772_231@ | DesTination 字段的网络掩码, 255.255.255.255为主机, 0.0.0.0是默认路由@H_772_231@ |
Flags@H_772_231@ | U 活动路由,H 目标是个主机,G 需要经过网关,R 恢复动态路由产生的表项,! 拒绝路由@H_772_231@ |
路由距离,到达指定网络所需的跳数@H_772_231@ | |
Ref@H_772_231@ | 路由项引用次数@H_772_231@ |
Use@H_772_231@ | 使用次数@H_772_231@ |
Iface@H_772_231@ | 通过接口@H_772_231@ |
3.3.2主机路由
路由表中指向单个 IP 地址或主机名的路由记录,其 Flags 字段标记 H。
192.168.10.22通过eth0接口出去,通过网关设备192.168.100.1转发。
root@ubuntu-snmp:/home/chenchao# route
DesTination Gateway Genmask Flags Metric Ref Use Iface
192.168.10.22 192.168.100.1 255.255.255.255 UGH 0 0 0 eth0
3.3.3网络路由
主机可以到达的网络。通过网关跳转路由,Flags标记G。
192.168.10.X的IP通过eth0接口出去,通过网关192.168.100.1转发。
root@ubuntu-snmp:/home/chenchao# route
DesTination Gateway Genmask Flags Metric Ref Use Iface
192.168.10.0 192.168.100.1 255.255.255.0 UG 0 0 0 eth0
3.3.4默认路由
当目标主机的 IP 地址或网络不在路由表中时,数据包就被发送到默认路由(默认网关)上。
root@ubuntu-snmp:/home/chenchao# route
DesTination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.100.1 0.0.0.0 UG 0 0 0 eth0
3.3.5路由跟踪
root@ubuntu-snmp:/home/chenchao# traceroute 192.168.10.22
traceroute to 192.168.10.22 (192.168.10.22), 30 hops max, 60 byte packets
1 192.168.100.1 (192.168.100.1) 0.500 ms 0.463 ms 0.367 ms
2 192.168.10.22 (192.168.10.22) 0.790 ms 0.935 ms 1.200 ms
3.3.6路由命令
1)添加路由:
route add -net 192.168.10.0 netmask 255.255.255.0 gw 192.168.100.1 dev eth0
2)删除路由:
route del -net 192.168.10.0 netmask 255.255.255.0
3)屏蔽路由:
route add -net 224.0.0.1 netmask 240.0.0.1 reject
4)添加默认网关:
route add default gw 192.168.100.1
5)删除默认网关:
route del default gw 192.168.100.1
4.ubuntu服务安装:
4.1 ssh server安装
#apt-get install openssh-server;查看服务:ps -e |grep ssh;启动服务:需要/etc/init.d/ssh start
4.2 TFTP server安装
#sudo apt-get install xinetd;sudo apt-get install tftp tftpd。再编辑配置文件vi /etc/xinetd.d/tftp
service tftp
{
socket_type =dgram
protocol =udp
wait =yes
user =root
server =/usr/sbin/in.tftpd
server_args = -s /tftpboot
disable =no
per_source =11
cps = 100 2
flags = IPv4
}
注意配置文件格式,及在根目录下创建tftpboot目录。输入sudo /etc/init.d/xinetd restart命令,重新启动服务。此时可以用tftp 客户端进行测试。在/tftpboot目录下存入a文件,使用tftp 127.0.0.1去取文件,>get a。如果正常,将a文件下载到当前工作目录下。
4.3 samba 安装
安装,卸载操作:
#apt-get install samba samba-common //安装
#sudo apt-get autoremove samba //卸载
配置配置文件:/etc/samba/smb.conf
[shares ]
comment=shares
path=/home/myshare
create mask=0755
directory mask=0755
writeable=yes
valid users=test
browseable=yes
重启服务:
#sudo /etc/init.d/samba stop
sudo /etc/init.d/samba start
5.系统管理:
1.用户名与密码:一般Linux系统的用户名与密码管理通过配置文件完成,以下两者配置配合完成。
/etc/passwd:文件中配置管理系统的用户的执行情况;
/etc/shadow:文件中配置管理系统的用户名对应的密码,及一些执行权限等情况。
6.虚拟专用网络服务器环境搭建
6.1 PPTP服务器配置
1.安装pptpd软件,即虚拟专用网络服务器软件。
#apt-get install pptpd
2.编辑配置文件/etc/pptpd.conf:
option /etc/ppp/pptpd-options
localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245
3.编辑配置项文件/etc/ppp/pptpd-options:(打开DNS配置)
@H_78_108@ms-dns 8.8.8.8 ms-dns 114.114.114.114
4.配置连接的用户名密码:/etc/ppp/chap-secrets
#user pptpd password *
admin pptpd 12345678 *
5.配置完成后,重启生效:
/etc/init.d/pptpd restart
6.检查pptpd服务是否运行正常:有以下端口服务信息证明运行正常
chenchao@ubuntu-snmp:~$ sudo netstat -anp |grep pptpd
tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 20869/pptpd
unix 2 [ ] DGRAM 66961 20869/pptpd
7.防火墙查看,如果配置了防火墙,需要让1723的tcp 端口号通过。(根据自己系统确认)
iptables -L
#或添加一个规则
iptables -I INPUT -p tcp --dport 1723 -j ACCEPT
8.查看客户端连接情况:10.10.10.99为连接的客户端
chenchao@ubuntu-snmp:~$ sudo netstat -anp |grep pptpd
tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 20869/pptpd
tcp 0 0 10.10.10.189:1723 10.10.10.99:60920 ESTABLISHED 21037/pptpd [10.10.
raw 0 0 10.10.10.189:47 10.10.10.99:* 1 21037/pptpd [10.10.
9.到目前为止,证明,客户端拨号到服务器的协议过程已经完成,证明搭建的服务也是正常的。但此时还不能保证对网络的后续访问是正常的。这个需要根据自己系统的网络情况进行配置。
通过客户端的情况查看:(本次是用openwrt提供的pptp进行测试)
ppp0 Link encap:point-to-point Protocol
inet addr:192.168.1.200 P-t-P:192.168.1.234 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1496 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:116 (116.0 B) TX bytes:84 (84.0 B)
ppp1 Link encap:point-to-point Protocol
inet addr:192.168.1.200 P-t-P:192.168.1.235 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1496 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:116 (116.0 B) TX bytes:84 (84.0 B)
此时,可以在服务器端ping通192.168.1.234/235;同样在客户端ping 192.168.1.200也是通的。对于openwrt系统,支持ssh登入,此时在服务器端ssh 192.168.1.234也可以正常访问。
10.测试:目前的测试结果为:
PPTP服务器生成的接口pppx可以通过接口分别ping通ppp客户端,这里不加指定接口也可以ping通。证明PPTP服务器有能力自动处理。
第三方标准PC,未有PPP连接,同样可以ping通PPTP服务器的IP;PPTP服务器ping出也是正常。
PPTP客户端之间ping不通。
第三方标准PC,ping PPTP客户端不通,同样反向也ping不通。
6.2 L2TP服务器配置
1.安装pptpd软件,即虚拟专用网络服务器软件。
#apt-get install xl2tpd ppp
2.配置xl2tpd.conf配置文件/etc/xl2tpd/xl2tpd.conf,配置文件信息如下:
[global]
ipsec saref = no
[lns default]
ip range = 10.10.10.200-10.10.10.220
local ip = 192.168.10.168
refuse chap = yes
refuse pap = yes
require authentication = yes
; name = L2TP×××
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
主要关注ip地址,及配置文件,其他默认。
3. 配置认证方式及DNS相关信息,/etc/ppp/options.xl2tpd。不存在时创建,跟xl2tpd.conf配置参数里的配置对应。配置信息如下:
require-chap
ms-dns 114.114.114.114
lcp-echo-interval 10
lcp-echo-failure 3
auth
这里配置的是CHAP认证方式。
4.添加链接的账户信息,配置用户名密码。配置文件/etc/ppp/chap-secrets,添加信息如下:
# Secrets for authentication using CHAP
# client server secret IP addresses
username * password *
第一个参数为Clinet的用户名,第二个参数为服务内容(即PPTP,L2TP等),第三个参数为密码,第四个参数对应的IP地址。*代表所有信息。根据3描述的是配置CHAP认证方式,及配置chap-secrets;也可以指定PAP认证方式,配置pap-secrets。
5.启动xl2tpd服务:
/etc/init.d/xl2tpd start #启动
/etc/init.d/xl2tpd stop #停止
/etc/init.d/xl2tpd restart #重新启动
启动后再查看下服务是否正常启动:
chenchao@ubuntu:~$ sudo netstat -anp |grep l2tp
udp 0 0 0.0.0.0:1701 0.0.0.0:* 18040/xl2tpd
unix 2 [ ] DGRAM 2009048 18040/xl2tpd
此时证明,服务已经正常启动。
6.查看客户端连接情况:
ppp0 Link encap:point-to-point Protocol
inet addr:192.168.8.168 P-t-P:192.168.8.200 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:152 errors:0 dropped:0 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:8367 (8.3 KB) TX bytes:9509 (9.5 KB)
ppp1 Link encap:point-to-point Protocol
inet addr:192.168.8.168 P-t-P:192.168.8.201 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:93 (93.0 B) TX bytes:99 (99.0 B)
此时可以看到有两个客户端的连接,分别是ppp0,ppp1。对应分配的IP地址为:192.168.8.200;192.168.8.201.
测试Clinet端的连通性。通过各自的接口去ping通Client端,均能够正常ping通。
chenchao@ubuntu:~$ ping -I ppp0 192.168.8.200
PING 192.168.8.200 (192.168.8.200) from 192.168.8.168 ppp0: 56(84) bytes of data.
64 bytes from 192.168.8.200: icmp_seq=1 ttl=64 time=2.27 ms
64 bytes from 192.168.8.200: icmp_seq=2 ttl=64 time=1.28 ms
^C
--- 192.168.8.200 ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 2020ms
rtt min/avg/max/mdev = 1.281/1.776/2.272/0.497 ms
chenchao@ubuntu:~$ ping -I ppp1 192.168.8.201
PING 192.168.8.201 (192.168.8.201) from 192.168.8.168 ppp1: 56(84) bytes of data.
64 bytes from 192.168.8.201: icmp_seq=1 ttl=64 time=1.85 ms
64 bytes from 192.168.8.201: icmp_seq=2 ttl=64 time=0.971 ms
64 bytes from 192.168.8.201: icmp_seq=3 ttl=64 time=0.927 ms
^C
--- 192.168.8.201 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2020ms
rtt min/avg/max/mdev = 0.927/1.249/1.850/0.426 ms
chenchao@ubuntu:~$
6.3 PPTP与L2TP区别
1、PPTP要求互联网络为IP网络。L2TP只要求隧道媒介提供面向数据包的点对点的连接。L2TP可以在IP(使用UDP),帧中继永久虚拟电路(PVCs)、X.25虚拟电路(VCs)或ATM网络上使用;
2、PPTP只能在两端点间建立单一隧道。L2TP支持在两端点间使用多隧道。使用L2TP,用户可以针对不同的服务质量创建不同的隧道
3、L2TP自身不提供隧道验证,从L2TP的包头可以看出。隧道认证是由PPP(pap或chap)协议提供!而PPTP则支持隧道验证,PPTP自身就是PPP的扩展!但是当L2TP或PPTP与IPsec共同使用时,可以由IPsec提供隧道验证,不需要在第2层协议上验证隧道.
6.4 IPsec
安装参考:https://cloud.tencent.com/developer/article/1545155
安装IPsec,使用参考脚本安装,脚本ipsec.sh如下:
脚本文件setup.sh
客户端测试:
一般需要配置以下参数:
Server IP: 192.168.100.189 //IPsec服务器IP
IPsec PSK: 123456 //密钥
Username: a17513502496 //用户名
password: a17513502496 //密码
android客户端:选择配置类型为IPsec Xauth PSK
windows 7客户端:
选项中去除“包括 windows 登录域(W)”,
安全中选择类型为L2TP/IPsec,并在高级配置中配置密钥。
windows拨号的时候,可能会出现809错误。解决方法为运行reg配置,配置如下:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYstem\CurrentControlSet\services\Rasman\Parameters] "ProhibitIpSec"=dword:00000001 [HKEY_LOCAL_MACHINE\SYstem\CurrentControlSet\services\PolicyAgent] "AssumeUDPEncapsulationContextOnSendRule"=dword:00000002
用txt编辑,修改为.reg文件,点击运行即可。如还有其他问题可以参考链接。
当客户端成功链接上服务器后,在客户端与服务器分别建立一个接口。
windows客户端接口
IPsec服务器端接口
ppp0 Link encap:point-to-point Protocol
inet addr:192.168.42.1 P-t-P:192.168.42.10 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1280 Metric:1
RX packets:4645 errors:0 dropped:0 overruns:0 frame:0
TX packets:5166 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:538702 (538.7 KB) TX bytes:3879516 (3.8 MB)
6.5.虚拟专用网络客户端测试
7.ubuntu搭建路由
7.1模拟场景
使用vmware安装搭建ubuntu路由来模拟网络环境。具体实现环境见图。
这里用一台win7系统安装vmware软件虚拟出四个ubuntu系统,分别为上图的A,B,C,D。按照拓扑,AD分别是测试PC,BC分别是路由器。AB/CD就是一个完整的路由过程。
7.2vmware配置过程
1.分别创建四个ubuntu虚拟系统,可以创建一个,克隆出三个。
2.添加虚拟网卡,由于router需要两个接口。
VMnet2,配置为主机模式,子网IP:10.1.0.0
VMnet3,配置为桥接模式,绑定物理网卡
VMnet4,配置为主机模式,子网IP:10.2.0.0
3.将虚拟网卡配置到虚拟机的网络适配器中。
IPsecA 配置网络适配器 VMnet2
IPsecB 配置网络适配器 VMnet2
IPsecB 配置网络适配器2 VMnet3
IPsecC 配置网络适配器 VMnet4
IPsecC 配置网络适配器2 VMnet3
IPsecD 配置网络适配器 VMnet4
3.配置ubuntu网络配置,/etc/network/interfaces,分别如下:
1)IPsecA
# The loopBACk network interface
auto lo
iface lo inet loopBACk
# The priMary network interface
auto eth0
iface eth0 inet static
address 10.1.0.10
netmask 255.255.255.0
gateway 10.1.0.1
dns-nameservers 10.1.0.1
2)IPsecB
# The loopBACk network interface
auto lo
iface lo inet loopBACk
auto eth0
iface eth0 inet static
address 10.1.0.1
netmask 255.255.255.0
gateway 10.1.0.254 #gw & dns 未使用
#dns-nameservers 10.1.0.254
auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.254
#dns-nameservers 192.168.0.254
3)IPsecC
# The loopBACk network interface
auto lo
iface lo inet loopBACk
auto eth0
iface eth0 inet static
address 10.2.0.1
netmask 255.255.255.0
gateway 10.2.0.254
#dns-nameservers 10.1.0.254
auto eth1
iface eth1 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.254
#dns-nameservers 192.168.0.254
4)IPsecD
# The loopBACk network interface
auto lo
iface lo inet loopBACk
# The priMary network interface
auto eth0
iface eth0 inet static
address 10.2.0.10
netmask 255.255.255.0
gateway 10.2.0.1
dns-nameservers 10.2.0.1
4.添加配置规则:
1)使能路由IP forWARD。
在/etc/sysctl.conf
net.ipv4.ip_forWARD = 1
或使用命令:
sudo echo 1 > /proc/sys/net/ipv4/ip_forWARD
2)配置iptables规则。
sudo iptables -t nat -A POSTRoutING -o eth1 -j MASQUERADE
sudo iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
查看iptables -L,发现在FORWARD中有DROP动作,目前仅为了配置网络正常通信,将DROP的rule删除。有需要再根据需要配置DROP规则。
7.3测试验证
如果一切配置正常,测试结果如下:
1)WIN7可以ping通IPsecA,IPsecB,IPsecC,IPsecD。
2)IPsecA与IPsecD ping不通,因为分别在各自的内网中相互隔离。
8.TCPDUMP抓包
详见(转载):https://blog.csdn.net/lgh1117/article/details/80213397
9. Linux下配置vlan
增加VLAN=100的虚接口在eth0上,#vconfig add eth0 100
在eth0.100虚接口上配置IP地址,#ifconfig eth0.100 10.10.10.20
使用ifconfig查看配置是否生效,#ifconfig
删除刚才配置的eth0.100虚接口,#vconfig rem eth0.100
-
点赞
-
收藏
-
分享
-
- 文章举报
chao103
发布了8 篇原创文章 · 获赞 1 · 访问量 2万+
私信
关注
本站总结
以上是本站教程为你收集整理的vmware配置管理ubuntu环境全部内容,希望文章能够帮你解决vmware配置管理ubuntu环境所遇到的程序开发问题。
如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。