1.搭建HTTP服务,让外网服务器能访问出去公网IP
2.NFS服务创建挂在目录/opt/www 和公司web服务器/var/www/htm1/关联挂载
3.Samba服务器创建不同团队的共享目录,主账户分别是t1,t2 对应的共享目录是/opt/t1和/opt/t2,团队1下面有一个子账户tom,对t1目录只能读,不能写。团队下面有一个子账户jack 对t2目录只能读,不能写
4.要求团队1和团队2的成员能访问公司外网服务(测试用samba服务器来访问)
5.DNS服务 202.0.0.100 www.51xit.top
203.0.0.03 www.kgc.com
1)交换机接口的配置
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#interface GigabitEthernet0/0/3 port link-type access
port default vlan 30
#interface GigabitEthernet0/0/4 port link-type access
port default vlan 50
#interface GigabitEthernet0/0/5 port link-type access
port default vlan 30
2)各个vlan配置网关地址
#vlanif 10 192.168.10.1/24
#vlanif 20 192.168.20.1/24
#vlanif 30 192.168.30.1/24
#vlanif 50 11.0.0.2/30(互联地址)
interface Vlanif10 ip address 192.168.10.1 255.255.255.0
#interface Vlanif20 ip address 192.168.20.1 255.255.255.0
#interface Vlanif30 ip address 192.168.30.1 255.255.255.0
#interface Vlanif50 ip address 11.0.0.2 255.255.255.252
3)交换机向上的方向配置一个默认路由,向下由于是直连网段,不需要配置路由
ip route-static 0.0.0.0 0.0.0.0 11.0.0.1
1)端口IP地址配置
interface GigabitEthernet0/0/0
ip address 11.0.0.1 255.255.255.252 #interface GigabitEthernet0/0/1
ip address 201.0.0.1 255.255.255.252
2)路由设置
向下内网的静态路由设置
ip route-static 192.168.10.0 255.255.255.0 11.0.0.2
ip route-static 192.168.20.0 255.255.255.0 11.0.0.2
ip route-static 192.168.30.0 255.255.255.0 11.0.0.2
向外的公网拥有膨大的IP地址,需设置一个默认路由
ip route-static 0.0.0.0 0.0.0.0 201.0.0.2
3)nat easy-ip设置,公司内网只用一个公网IP地址
acl 3000
rule permit ip source 192.168.10.0 0.0.0.255
rule permit ip source 192.168.20.0 0.0.0.255
rule permit ip source 192.168.30.0 0.0.0.255
int g0/0/1
nat outbound 3000
4)nat server设置,公司WEB服务器要被公网访问,将以公网IP地址映射出去
int g0/0/1
nat server protocol tcp global 202.0.0.100 www inside 192.168.30.100 www
1)路由器的端口IP地址配置
interface GigabitEthernet0/0/1
ip address 201.0.0.2 255.255.255.252
#interface GigabitEthernet0/0/2
ip address 203.0.0.1 255.255.255.0
2)配置一个nat server 的回程路由
ip route-static 202.0.0.100 255.255.255.255 201.0.0.1
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭核心防护
vi /etc/selinux/config SELINUX=disabled
安装apache网站浏览器
yum -y install httpd
systemctl restart httpd
systemctl enable httpd
服务器端
#yum -y install nfs
#yum -y install rpcbind
#mkdir /opt/www
#vi /etc/exports
...........................
/opt/www 192.168.30.100(rw,sync,no_root_squash)
#systemctl restart nfs
#systemctl restart rpcbind
#showmount -e
Export list for localhost.localdomain:
/opt/www 192.168.30.100
客户机端(公司内网web服务器)
#yum -y install nfs
#yum -y install rpcbind
#showmount -e 192.168.30.10
#mount 192.168.30.10:/opt/www /var/www/htm1
#vi /etc/fstab
192.168.30.10:/opt/www /var/www/htm1 nfs defaults,_netdev 0 0
#systemctl restart nfs
#systemctl restart rpcbind
测试nfs服务搭建成功服务器端
#cd /opt/www
#touch 1.txt
#cd /var/www/htm1
#vi 1.txt
实现了服务端与客户端之间的文件共享,除上诉操作外,在客户端对已关联的目录编辑也会同步到服务器端的关联目录
Samba服务器创建不同团队的共享目录,主账户分别是t1,t2对应的共享目录是/opt/t1和/opt/t2,团队1下面有一个子账户tom,对t1目录只能读,不能写。团队下面有一个子账户jack对t2目录只能读,不能写
#yum -y install samba
#rpm -qa | grep samba
samba-common-tools-4.8.3-4.el7.x86_64
samba-client-libs-4.8.3-4.el7.x86_64 samba-common-4.8.3-4.el7.noarch
samba-client-4.8.3-4.el7.x86_64 samba-4.8.3-4.el7.x86_64
samba-common-libs-4.8.3-4.el7.x86_64 samba-libs-4.8.3-4.el7.x86_64
#cd /etc/samba/
#grep -v "^#" smb.conf > smb.conf1
#grep -v "^$" smb.conf1 > smb.conf2
#grep -v "^;" smb.conf2 > smb.conf3
#mv smb.conf smb.conf2020.8.7bak
#mv smb.conf3 smb.conf
#mkdir /opt/t1
#mkdir /opt/t2
#useradd t1
#useradd t2
#useradd tom
#useradd jack
#vi /etc/samba/smb.conf
[t1]
path = /opt/t1
public = no
valid users = t1,tom
write list = t1
[t2]
path = /opt/t2
public = no
valid users = t2,jack
write list = t2
#pdbedit -a -u t1
#pdbedit -a -u tom
#pdbedit -a -u jack
#systemctl restart smb
#systemctl enable smb
#chown t1:tom /opt/t1
#chown t2:jack /opt/t2
#chmod 750 /opt/t1 /opt/t2
对samba服务的测试
客户端测试(公司web服务器)
可以看到t1 t2的目录
利用t1账号登陆进t1目录
利用jack登陆t2目录
#yum -y -install httpd
#yum -y install named
#vi /etc/named.conf
options { listen-on port 53 { 203.0.0.2; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt"; recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
#vi /etc/named.rfc1912.zones
zone "51xit.top" IN {
type master;
file "51xit.top.zone";
};
zone "kgc.com" IN {
type master;
file "kgc.com.zone";
};
#vi /var/named/kgc.com
TTL 1D@ IN SOA kgc.com. admin.kgc.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 203.0.0.3
www IN A 203.0.0.3
ftp IN A 203.0.0.4
mail IN CNAME www
#vi /var/named/51xit.top
VTTL 1D@ IN SOA kgc.com. admin.kgc.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @ A 203.0.0.3
www IN A 203.0.0.3
ftp IN A 203.0.0.4
mail IN CNAME www
#vi /etc/resolv.conf
#Generated by NetworkManager
nameserver 203.0.0.2
1)在内网的一个IP=192.168.30.10的服务器上进行测试
2)在外网的选择一个IP=20.0.0.2的服务器上进行测试