Linux基础-------IP、防火墙及网卡设置

/下的目录介绍:

/root               #root用户的家目录
/home               #存储普通用户家目录 
lost+found           这个目录平时是空的,存储系统非正常关机而留下“无家可归”的文件
/usr                #系统文件,相当于C:\Windows
/usr/local          #软件安装的目录,相当于C:\Program
/usr/bin            #普通用户使用的应用程序
/usr/sbin           #管理员使用的应用程序
/usr/lib            #库文件Glibc 32bit
/usr/lib64          #库文件Glibc 64bit
/boot               #存放的系统启动相关的文件,例如kernel
/etc                #配置文件(系统相关如网络/etc/sysconfig/network)
/tmp                #临时文件(系统:程序产生的临时文件)
/opt                #空目录,第三方应用(tomcat)
/media              #用于挂载u盘,光驱等自动识别的设备
/srv                #存放服务启动后产生的数据目录
/var                #存放的是一些变化文件,比如数据库,日志,邮件....
/proc               #虚拟文件系统,系统程序文件所处目录 。虚拟文件系统:只要关机就会没有。内核的虚拟映射目录
/mnt                #系统提供这个目录是让用户临时挂载其他的文件系统娱乐

网卡设置

启动网卡 
[root@agiao ~] ifup ens33 
​
重启网卡
[root@agiao ~]# systemctl restart network  
​
网卡配置文件
[root@agiao ~]# vi  /etc/sysconfig/network-scripts/ifcfg-ens33  云 eth0  
把光标移到ONBOOT=no  no改为yes后保存退出 重启网卡生效 开机自启
​


查询服务器ip
[root@agiao ~]# ip a 
​
显示版本信息
[root@agiao ~]# touch  --version
​
获取公网数据
httpbin.org/ip

设置ip

设置网卡开机自启 
[root@agiao ~]#  vim  /etc/sysconfig/network-scripts/ifcfg-ens33
    ONBOOT=no 改为yes  然后保存退出 重启网卡后生效  
​
固定服务器ip地址
[root@agiao ~]#  vim  /etc/sysconfig/network-scripts/ifcfg-ens33
​
BOOTPRTOT=dhcp (动态) static(静态)
IPADDR=192.168.100.175  IP地址
PREFIX=24  子网掩码
GATEWAY=192.168.100.2  网关
DNS1=114.114.114.114
DNS2=8.8.8.8       重启网络服务后生效


​
[root@agiao ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPRTOT=static
IPADDR=192.168.100.175
PREFIX=24
GATEWAY=10.12.155.254
DNS1=114.114.114.114
DNS2=8.8.8.8



​
启动网卡
[root@agiao ~]# ifup ens33
​
查询ip地址
[root@agiao ~]# ip a 
​
重启网卡  
[root@agiao ~]# systemctl restart network

重启网卡后找不到ip

[root@agiao ~]# systemctl stop NetworkManager
[root@agiao ~]# systemctl disable NetworkManager

selinux和防火墙设置

关机服务器
 立刻关机 
[root@agiao ~]# poweroff 
[root@agiao ~]# init 0
​
重启服务器
[root@agiao ~]# reboot
[root@agiao ~]# init 6 
​
一.selinux 
​
查看selinux状态
[root@agiao ~]# getenforce  
显示打开
Enforcing 
​
[root@agiao ~]# setenforce 0 
显示临时关闭 
Permissive  
​
第一种方式
[root@agiao ~]# vi /etc/selinux/config
SELINUX=disabled
显示永久关闭
Disabled 
第二种方式   
        sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config 
​
二.防火墙
查看防火墙状态 
[root@agiao ~]# systemctl status firewalld  
临时关闭防火墙
[root@agiao ~]# systemctl stop  firewalld  
永久关闭防火墙
[root@agiao ~]# systemcal disable firewalld 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值