terte 发表于 2018-4-9 13:10:42

Tomcat虚拟主机配置(基于域名/端口)


Ubuntu 16.04.3 LTS 双网卡配置
需求

    双网卡实现一个静态ip分配,另外一个dhcp
    实现
    准备工作:

    wanghui@wanghui:~$ sudo su - #需要跳到root用户
    password for wanghui:
    root@wanghui:~# apt-get install openssh-server vim -y #安装sshd服务和vim编辑器
    root@wanghui:~# /etc/init.d/ssh start #启动ssh服务
    root@wanghui:~# ifconfig | awk '{print $1}' | grep 'en' #查看网卡
    ens33 #这个是要DHCP的
    ens34 #这个是要static的

    修改网卡配置文件

    root@wanghui:~# vim /etc/network/interfaces #修改网卡配置文件
    auto lo
    iface lo inet loopback
    auto ens33
    iface ens33 inet dhcp
    auto ens34
    iface ens34 inet static
    address 192.168.56.31
    netmask 255.255.255.0

    修改网管配置文件:

    root@wanghui:~# vim /etc/NetworkManager/NetworkManager.conf #修改网管文件,可以使得不重启就让修改的ip配置生效
    managed=true #把这个默认的false参数改成true,就能在重启网卡的时候刷新配置到系统

    服务重启

    root@wanghui:~# /etc/init.d/network-manager restart #重启网管
    root@wanghui:~# /etc/init.d/networking restart #重新加载ip配置

    此时就可以看到配置的ip了

    root@wanghui:~# hostname -I
    192.168.85.152 192.168.56.31



页: [1]
查看完整版本: Tomcat虚拟主机配置(基于域名/端口)