Linux 網路配置 防火牆 YUM

2021-09-02 18:36:21 字數 2504 閱讀 4877

目標

1、 網路的配置

2、 防火牆的設定

3、 光碟自動掛載

4、 本地yum源的配置

[b]1、 網路的配置[/b]

一、新增臨時ip

ifconfig eth0 第乙個ip位址 netmask 子網掩碼 up

ifconfig eth0:0 第二個ip位址 netmask 子網掩碼 up

二、檢視networkmanager服務是是否啟動

# systemctl status networkmanager

使用圖形化設定

# nmtui

[img]

新增 修改 刪除 儲存退出

# systemctl restart network 重啟服務

三、使用命令修改ip

# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 //網絡卡配置檔案

type="ethernet"

bootproto="static"

defroute="yes"

peerdns="yes"

peerroutes="yes"

ipv4_failure_fatal="no"

ipv6init="yes"

ipv6_autoconf="yes"

ipv6_defroute="yes"

ipv6_peerdns="yes"

ipv6_peerroutes="yes"

ipv6_failure_fatal="no"

name="eno16777736"

uuid="c9b5904f-b5c2-492d-a23b-1611742ba8c9"

device="eno16777736"

onboot="yes"

ipaddr=192.168.145.137

gateway=192.168.145.2

dns1=

prefix=24

按esc --> 輸入 :wq 回車 儲存退出

[b]2、 防火牆的設定[/b]

# systemctl status firewalld.service # 檢視狀態

# systemctl stop firewalld #臨時關閉

# systemctl disable firewalld #開機自動關閉

關閉selinux並設定開機自動關閉

//臨時關閉

# setenforce 0

//永久關閉

# vim /etc/sysconfig/selinux

[img]

[b]3、 光碟自動掛載[/b]

# echo "/dev/cdrom /mnt iso9660 defaults 0 0 " >> /etc/fstab //類似 vim /etc/fstab 然後在檔案末尾新增

# mount -a //檢視掛載

# df -th //檢視掛載點

[b]4、 本地yum源的配置[/b]

首先要掛載 本地光碟檔案 (步驟3 ,這裡的掛載點為 /mnt)

//檢視已經配置的yum源文

# ll /etc/yum.repos.d/

# vim /etc/yum.repos.d/rhel.repo

[rhel7-server]

name=rhel7-server

baseurl=file:///mnt

enabled=1

gpgcheck=0

# yum clean all #清空yum快取

# yum list #生成快取列表

//ok

[b]yum針對軟體包操作常用命令: [/b]

1.使用yum查詢軟體包

命令:yum search

2.列出所有可安裝的軟體包

命令:yum list

3.列出所有可更新的軟體包

命令:yum list updates

4.列出所有已安裝的軟體包

命令:yum list installed

5.列出所有已安裝但不在 yum repository 內的軟體包

命令:yum list extras

6.列出所指定的軟體包

命令:yum list

7.使用yum獲取軟體包資訊

命令:yum info

8.列出所有軟體包的資訊

命令:yum info

9.列出所有可更新的軟體包資訊

命令:yum info updates

10.列出所有已安裝的軟體包資訊

命令:yum info installed

11.列出所有已安裝但不在 yum repository 內的軟體包資訊

命令:yum info extras

12.列出軟體包提供哪些檔案

命令:yum provides

linux網路及防火牆配置

etc sysconfig network 包括主機基本網路資訊,用於系統啟動 etc sysconfig network script 此目錄下是系統啟動最初始化網路的資訊 etc sysconfig network script ifcfg eth0 網路配置資訊 etc xinetd.conf...

Linux防火牆配置

重啟後生效 開啟 chkconfig iptables on 關閉 chkconfig iptables off 2 即時生效,重啟後失效 開啟 service iptables start 關閉 service iptables stop 需要說明的是對於linux下的其它服務都可以用以上命令執行...

linux 防火牆配置

把tcp的80埠配置為允許任何ip訪問 iptables i input ptcp dport 80 j accept 上面第三步的方法只是臨時生效的,只要你重啟了虛擬機器或者說重啟了linux,就必須重新設定才可以訪問,解決辦法如下 在命令列下輸入 vi etc selinux config 修改...