静态网卡配置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

相关推荐
pps-key几秒前
Afrog漏洞扫描器:从入门到入狱......边缘的摇摆记录(pps-key黑化版)
linux·计算机网络·安全·网络安全
学Linux的语莫12 分钟前
linux的root目录缓存清理
linux·运维·服务器
oMcLin14 分钟前
如何在 SUSE Linux Enterprise Server 15 上部署并优化 K3s 集群,提升轻量级容器化应用的资源利用率?
linux·运维·服务器
L_090741 分钟前
【Linux】进程概念
linux
Ghost Face...1 小时前
深入解析YT6801驱动模块架构
linux·运维·服务器
线束线缆组件品替网1 小时前
Amphenol LTW 防水线缆 IP67/IP68 结构解析
运维·网络·人工智能·汽车·硬件工程·材料工程
LaoZhangGong1231 小时前
学习TCP/IP的第1步:ARP数据包
网络·stm32·学习·tcp/ip·以太网·arp·uip
比奇堡派星星1 小时前
Linux 杂项设备驱动框架详解
linux·arm开发·驱动开发
Eternity∞1 小时前
基于Linux系统vim编译器情况下的C语言学习
linux·c语言·开发语言·学习·vim
芝麻馅汤圆儿1 小时前
cpu 大小核
linux·运维·centos