ubuntu 设置静态ip
ubuntu 设置静态ip
网络相关命令:
alt+t 快捷键打开终端
关闭对应的网络
sudo ifconfig enp3s0 down
开启网络
sudo ifconfig enp3s0 up
通过这个命令sudo ifconfig enp3s0 down up可以查看对应的网口的指示灯是否亮起或熄灭,来确定对应的enp3s0 名字是否正确
重启网络:
sudo /etc/init.d/networking restart
如果报:the remote system refused the connection
则安装 ssh
sudo apt-get install openssh-server
使用动态主机配置协议动态的配置网络接口的网络参数
sudo dhclient
配置静态IP
sudo vim /etc/network/interface
sudo vim /etc/resolvconf/resolv.conf.d/head
开启/关闭防火墙
查看当前防火墙状态
sudo ufw status
inactive状态是防火墙关闭状态 active是开启状态
开启
sudo ufw enable
关闭
sudo ufw disable
Ubuntu中其他常用的防火墙命令
外来访问默认允许/拒绝
ufw default allow/deny
允许/拒绝 访问20端口,20后可跟/tcp或/udp,表示tcp或udp封包。
ufw allow/deny 20
ufw从/etc/services中找到对应service的端口,进行过滤。
ufw allow/deny servicename
允许自10.0.1.0/10的tcp封包访问本机的25端口。
ufw allow proto tcp from 10.0.1.0/10 to 本机ip port 25
删除以前定义的”允许/拒绝访问20端口”的规则
ufw delete allow/deny 20
18.04
16.04
ifconfig:查看
ifconfig
设置完成后需要执行下面两步:
sudo ifconfig enp3s0 down
sudo ifconfig enp3s0 up
下面的与ip无关,纯粹记个图片笔记:
安装opengl
sudo-get update
sudo apt install mesa-common-dev
还没有评论,来说两句吧...