静态网卡配置centos、kali、ubantu

==================================================

centos

vim /etc/sysconfig/network-scripts/ifcfg-ens33

内容:

BOOTPROTO=static

IPADDR=

NETMASK=

GATEWAY=

DNS1=114.114.114.114

DNS2=8.8.8.8

service network restart

systemctl restart network

防火墙:

systemctl enable firewalld.service

systemctl disable firewalld.service

firewall-cmd --state

=======================================================

kali

vi /etc/network/interfaces

内容:

auto eth0 网卡名称

iface eth0 inet static #静态,想弄成自动分配的把static改成dhcp就可以了

address #IP

netmask 255.255.255.0 #子网掩码

gateway #网关

DNS文件

vi /etc/resolv.conf

nameserver 8.8.8.8

nameserver 114.114.114.114

systemctl restart networking

防火墙:

systemctl start firewalld #启动firewalld服务

systemctl stop firewalld #关闭firewalld服务

systemctl restart firewalld #重启firewalld服务

========================================================

ubantu

vim /etc/network/interfaces

auto ens33 # 默认动态配置网卡信息,如果需要配置网卡为动态ip,直接写这一句即可,不需要再添加下面四行的配置信息

iface ens33 inet static # 指定配置网卡为静态ip

address 192.168. # 网卡ip地址

gateway 192.168. # 网关

netmask 255.255.255.0 # 子网掩码

dns-nameservers 8.8.8.8 # dns,可以连着写多个,如dns-nameservers 8.8.8.8 114.114.114.114,用空格分隔开即可

sudo systemctl restart NetworkManager.service

sudo /etc/init.d/networking restart

防火墙:

sudo iptables-save > iptables.rules

sudo service iptables stop

sudo service iptables start

sudo ufw allow in

sudo ufw disable

相关推荐
是小小张呀10 分钟前
WSL Ubuntu修改主机名重启后失效解决方案
linux
一个有温度的技术博主38 分钟前
Redis系列三:在linux上安装Redis
linux·数据库·redis
m0_694845571 小时前
Oh My Zsh 使用指南:Zsh 终端配置与插件管理教程
服务器·前端·小程序·开源·github
linwq81 小时前
网络基础知识一
网络
阿常呓语1 小时前
Linux命令 date详解
linux·运维·服务器·linux command
xlp666hub1 小时前
【Linux驱动实战】:最简单的内核模块
linux·面试
EasyGBS1 小时前
EasyGBS适配国密GB35114协议的核心技术对别解析
网络·安全·gb28181
淡泊if1 小时前
K8s 网络排障:从抓包开始,一步步定位诡异“502”
网络·kubernetes·k8s
黄金大师傅1 小时前
OSPF协议综合实验
网络·智能路由器
虾..1 小时前
Linux HTTP服务器
linux·服务器·http