ubuntu 相关(用户和网络)

  • 增加用户

useradd dolton

passwd dolton

sudo chmod u+w /etc/sudoers 

sudo vi  /etc/sudoers

       

# User privilege specification
root    ALL=(ALL:ALL) ALL
dolton  ALL=(ALL:ALL) ALL

mkdir /home/dolton

chown dolton  /home/dolton -R

chmod 777 /home/dolton

vim /etc/passwd

dolton:x:1012:1012::/home/dolton:/bin/bash
  • 网卡IP :   sudo gedit /etc/network/interfaces 进行配置

添加内容:
auto ens5f0 
iface ens5f0 inet static 
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 192.168.2.22,1.2.3.4

然后重启网络
sudo /etc/init.d/networking restart

net plan 配置静态:

network:
  ethernets:
    ens5f1:
       dhcp4: false 
       addresses: [10.50.32.108/22, ] 
       gateway4: 10.50.35.254 
       nameservers:
           addresses: [10.50.16.1,10.50.16.2] 

vpn:

Easy way setup or install VPN OpenVPN on Ubuntu 20.04 ,I tested on my server. It work well.

1. Update your system

First, run the apt command to apply security updates:

sudo apt update
sudo apt upgrade

2. Download and run openvpn-install.sh script

DOwnload installation script using short url as follow and update chmod :

wget https://git.io/vpn -O openvpn-ubuntu-install.sh
chmod -v +x openvpn-ubuntu-install.sh
sudo ./openvpn-ubuntu-install.sh

Select UDP (recomendded), Port default, DNS use 1.1.1.1 or Google, client name, just give some name for example client-vpn, then openvpn will generate file client-vpn.ovpn in the /root directory

3. Check status, start, stop or restart service

sudo systemctl status openvpn-server@server.service
sudo systemctl start openvpn-server@server.service
sudo systemctl stop openvpn-server@server.service
sudo systemctl restart openvpn-server@server.service

4. Using opvn file

On Windows, install OpenVPN GUI and load client-vpn.ovpn file. From taskbar, right click OpenVPN icon and select appropriate vpn and click connect. OpenVPN will generate private/local IP addresses such as 10.8.0.1/32

5. Test/Verify connection

ping 10.8.0.1 #Ping to the OpenVPN server gateway
ip route #Make sure routing setup working
## the following must return public IP address of OpenVPN server ##
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

6. Add or remove a new VPN user with a certificate

You need to run the same script again for adding or removing a new VPN user to TLS certificate. For instance:

$ sudo ./openvpn-ubuntu-install.sh

This is summary from Ubuntu 20.04 LTS Set Up OpenVPN Server In 5 Minutes

7  look client ip  list

sudo cat /etc/openvpn/server/ipp.txt

https://gist.github.com/ebta/301f286fa9056d67e61bfc7cedd4ad56

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值