网络与安全

简介:

1、网卡IP

使用ifconfig和ip add命令查看网卡IP。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
[root@server01 ~] # ifconfig  ##查看网卡IP,如果不支持,需要安装net-tools
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 192.168.137.100  netmask 255.255.255.0  broadcast 192.168.137.255
         inet6 fe80::c1d7:5856:9856:2bb8  prefixlen 64  scopeid 0x20<link>
         ether 00:0c:29:0c:4d:a8  txqueuelen 1000  (Ethernet)
         RX packets 34093  bytes 19129820 (18.2 MiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 2629771  bytes 3934887034 (3.6 GiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
         inet 127.0.0.1  netmask 255.0.0.0
         inet6 ::1  prefixlen 128  scopeid 0x10<host>
         loop  txqueuelen 1  (Local Loopback)
         RX packets 76  bytes 6204 (6.0 KiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 76  bytes 6204 (6.0 KiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
[root@server01 ~] # ifconfig -a  ##查看所有网卡IP
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 192.168.137.100  netmask 255.255.255.0  broadcast 192.168.137.255
         inet6 fe80::c1d7:5856:9856:2bb8  prefixlen 64  scopeid 0x20<link>
         ether 00:0c:29:0c:4d:a8  txqueuelen 1000  (Ethernet)
         RX packets 34104  bytes 19130770 (18.2 MiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 2629778  bytes 3934888746 (3.6 GiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
         inet 127.0.0.1  netmask 255.0.0.0
         inet6 ::1  prefixlen 128  scopeid 0x10<host>
         loop  txqueuelen 1  (Local Loopback)
         RX packets 76  bytes 6204 (6.0 KiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 76  bytes 6204 (6.0 KiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
[root@server01 ~] # ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
     link /loopback  00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1 /8  scope host lo
        valid_lft forever preferred_lft forever
     inet6 ::1 /128  scope host
        valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
     link /ether  00:0c:29:0c:4d:a8 brd ff:ff:ff:ff:ff:ff
     inet 192.168.137.100 /24  brd 192.168.137.255 scope global ens33
        valid_lft forever preferred_lft forever
     inet6 fe80::c1d7:5856:9856:2bb8 /64  scope link
        valid_lft forever preferred_lft forever

如果要附加一个地址,可以设定虚拟网卡ens33:1。然后使用ifdown ens33/ifup ens33命令重新启动网卡,使配置生效。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@server01 ~] # mii-tool ens33  ##查看网卡连接状态
ens33: negotiated 1000baseT-FD flow-control, link ok
[root@server01 ~] # ethtool ens33   ##查看网卡连接状态
Settings  for  ens33:
         Supported ports: [ TP ]
         Supported link modes:   10baseT /Half  10baseT /Full
                                 100baseT /Half  100baseT /Full
                                 1000baseT /Full
         Supported pause frame use: No
         Supports auto-negotiation: Yes
         Advertised link modes:  10baseT /Half  10baseT /Full
                                 100baseT /Half  100baseT /Full
                                 1000baseT /Full
         Advertised pause frame use: No
         Advertised auto-negotiation: Yes
         Speed: 1000Mb /s
         Duplex: Full
         Port: Twisted Pair
         PHYAD: 0
         Transceiver: internal
         Auto-negotiation: on
         MDI-X: off (auto)
         Supports Wake-on: d
         Wake-on: d
         Current message level: 0x00000007 (7)
                                drv probe link
         Link detected:  yes                          ##该行“yes”表示网卡连接正常


2、DNS

1
2
3
4
5
6
7
8
9
10
11
12
[root@server01 ~] # hostnamectl  set-hostname juispan  ##更改主机名
[root@server01 ~] # bash
[root@juispan ~] #
[root@server01 ~] # cat /etc/resolv.conf  ##DNS的配置文件
# Generated by NetworkManager
nameserver 114.114.114.114            ##使用nameserver定义DNS,可以写多个DNS
[root@server01 ~] #
[root@server01 ~] # cat /etc/hosts    ##本地hosts文件,IP和域名映射  
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
##一个IP能对应多个域名,一个域名对应一个IP;
##域名对应IP,以最后的映射为准。


3、防火墙

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@server01 ~] # setenforce 0  ##临时关闭selinux
[root@server01 ~] # getenforce    ##查看selinux状态
Permissive
[root@server01 ~] # cat /etc/selinux/config  ##selinux配置文件
 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing               ##改成disabled可以永久关闭
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

在CentOS 7之前使用netfilter防火墙;CentOS 7开始使用firewalld防火墙。CentOS 7默认采用的是firewalld管理netfilter子系统,底层调用的仍然是iptables命令。不同的防火墙软件相互间存在冲突,使用某个时应禁用其他的。

▎关闭firewalld开启netfilter:

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@server01 ~] # systemctl stop firewalld
[root@server01 ~] # systemctl disable firewalld
Removed  symlink  /etc/systemd/system/dbus-org .fedoraproject.FirewallD1.service.
Removed  symlink  /etc/systemd/system/basic .target.wants /firewalld .service.
[root@server01 ~] # yum install -y iptables-services
......
已安装:
   iptables-services.x86_64 0:1.4.21-17.el7
   
完毕!
[root@server01 ~] # systemctl enable iptables
Created  symlink  from  /etc/systemd/system/basic .target.wants /iptables .service to  /usr/lib/systemd/system/iptables .service.
[root@server01 ~] # systemctl start iptables


4、Netfilter

▎Netfilter有5张表,filter和nat表需要熟练掌握:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
filter:
    This is the default table( if  no -t option is passed).It contains the built- in  chains INPUT( for  packets destined to  local  sockets),FORWARD( for  packets being routed through the box),and OUTPUT( for  locally-generated packets).
##filter表用于过滤包,是最常用的表,有INPUT、FORWARD、OUTPUT三个链。
nat:
    This table is consulted when a packet that creates a new connection is encountered.It consists of three  built-ins:PREROUTING( for  altering packets as soon as they come  in ),OUTPUT( for  altering locally-generated packets before routing),and POSTROUTING( for  altering packets as they are about to go out).IPv6 NAT support is available since kernel 3.7.
##nat表用于网络地址转换,有PREROUTING、OUTPUT、POSTROUTING三个链。
mangle:
    This table is used  for  specialized packet alteration.Until kernel 2.4.17 it had two built- in  chains:PREROUTING( for  altering incoming packets before routing) and OUTPUT( for  altering locally-generated packets before routing).Since kernel 2.4.18, three other built- in  chains are also supported:INPUT( for  packets coming into the box itself),FORWARD( for  altering packets being routed through the box),and POSTROUTING ( for  altering packets as they are about to go out).
##managle表用于给数据包做标记,几乎用不到。
raw:
    This table is used mainly  for  configuring exemptions from connection tracking  in  combination with the NOTRACK target.It registers at the net‐filter hooks with higher priority and is thus called before ip_conntrack,or any other IP tables.It provides the following  built- in  chains:PREROUTING ( for  packets arriving via any network interface) OUTPUT ( for  packets generated by  local  processes)
##raw表可以实现不追踪某些数据包,几乎用不到。
security:
    This table is used  for  Mandatory Access Control (MAC) networking rules, such as those enabled by the SECMARK and CONNSECMARK targets.Mandatory Access Control is implemented by Linux Security Modules such as SELinux.The security table is called after the filter table,allowing any Dis‐cretionary Access Control(DAC) rules  in  the filter table to take effect before MAC rules.This table provides the following built- in  chains:INPUT ( for  packets coming into the box itself), OUTPUT ( for  altering locally-generated packets before routing), and FORWARD ( for  altering packets being routed through the box).
##security表在CentOS 6中并没有,用于强制访问控制(MAC)的网络规则,几乎用不到。
本文转自Grodd51CTO博客,原文链接:http://blog.51cto.com/juispan/1946904,如需转载请自行联系原作者

相关文章
|
1月前
|
云安全 机器学习/深度学习 安全
云端防御战线:云计算安全与网络防护策略
【2月更文挑战第30天】 在数字转型的浪潮中,云计算已成为企业IT架构的核心。然而,随着云服务应用的普及,网络安全威胁也随之增加。本文将深入探讨云计算环境中面临的安全挑战,并剖析如何通过一系列先进的技术手段和策略来加强数据保护,确保信息资产的安全。我们将讨论包括加密技术、身份认证、入侵检测系统、安全事件管理等在内的多种安全措施,并分析这些措施如何协同工作以形成一个多层次的防御体系。
|
1月前
|
安全 网络协议 Unix
网络安全产品之认识安全隔离网闸
随着互联网的发展,网络攻击和病毒传播的方式越来越复杂,对网络安全的要求也越来越高。传统的防火墙设备在面对一些高级的网络攻击时,往往难以做到全面的防护,因此需要一种更加有效的网络安全设备来提高网络的安全性。此外,随着信息技术的不断发展,各个行业对信息系统的依赖程度也越来越高,一旦信息系统遭受攻击或入侵,可能会导致数据泄露、系统瘫痪等严重后果。因此,对于一些高安全级别的网络环境,如政府、军队、公安、银行等,需要一种更加可靠的安全设备来保证网络的安全性。在这样的背景下,安全隔离网闸作为一种新型的网络安全设备应运而生。本文让我们一起来认识安全隔离网闸。
44 0
|
1月前
|
存储 安全 网络安全
构筑安全堡垒:云计算环境下的网络安全与防护策略
【2月更文挑战第31天】 在信息技术迅猛发展的当代,云计算以其高效、灵活和成本优化的特点成为企业数字化转型的重要支撑。然而,随着云服务的广泛应用,数据的安全与隐私保护问题也日益凸显。本文将深入探讨在复杂多变的云计算环境中,如何通过创新技术和策略加强网络安全防护,确保信息安全。我们将分析当前云计算服务中存在的安全威胁,探讨加密技术、身份认证、访问控制以及入侵检测等关键技术的应用,并提出一个多层次、综合性的安全防护框架,以助力企业在享受云计算便利的同时,有效防范安全风险。
|
1月前
|
存储 安全 网络安全
云计算与网络安全:构建数字化安全堡垒
在当今数字化时代,云计算技术的快速发展为企业提供了更便捷高效的信息化解决方案,然而,随之而来的网络安全隐患也备受关注。本文将探讨云计算与网络安全的紧密关系,分析云服务、网络安全、信息安全等技术领域的发展现状,以及如何通过有效的策略和技术手段构建数字化安全堡垒,确保信息安全与数据隐私。
13 1
|
2天前
|
安全 JavaScript 前端开发
第十六届山东省职业院校技能大赛中职组 “网络安全”赛项竞赛试题—B模块安全事件响应/网络安全数据取证/应用安全
该内容描述了一次网络安全演练,包括七个部分:Linux渗透提权、内存取证、页面信息发现、数字取证调查、网络安全应急响应、Python代码分析和逆向分析。参与者需在模拟环境中收集Flag值,涉及任务如获取服务器信息、提权、解析内存片段、分析网络数据包、处理代码漏洞、解码逆向操作等。每个部分都列出了若干具体任务,要求提取或生成特定信息作为Flag提交。
5 0
|
2天前
|
安全 测试技术 网络安全
2024年山东省职业院校技能大赛中职组 “网络安全”赛项竞赛试题-C安全事件响应/网络安全数据取证/应用安全
B模块涵盖安全事件响应和应用安全,包括Windows渗透测试、页面信息发现、Linux系统提权及网络安全应急响应。在Windows渗透测试中,涉及系统服务扫描、DNS信息提取、管理员密码、.docx文件名及内容、图片中单词等Flag值。页面信息发现任务包括服务器端口、主页Flag、脚本信息、登录成功信息等。Linux系统渗透需收集SSH端口号、主机名、内核版本,并实现提权获取root目录内容和密码。网络安全应急响应涉及删除后门用户、找出ssh后门时间、恢复环境变量文件、识别修改的bin文件格式及定位挖矿病毒钱包地址。
9 0
|
2天前
|
安全 测试技术 Linux
2024年山东省职业院校技能大赛中职组 “网络安全”赛项竞赛试题-A模块安全事件响应/网络安全数据取证/应用安全
该内容描述了一个网络安全挑战,涉及Windows和Linux系统的渗透测试以及隐藏信息探索和内存取证。挑战包括使用Kali Linux对Windows Server进行服务扫描、DNS信息提取、密码获取、文件名和内容查找等。对于Linux系统,任务包括收集服务器信息、提权并查找特定文件内容和密码。此外,还有对Server2007网站的多步骤渗透,寻找登录界面和页面中的隐藏FLAG。最后,需要通过FTP获取win20230306服务器的内存片段,从中提取密码、地址、主机名、挖矿程序信息和浏览器搜索关键词。
5 0
|
2天前
|
安全 测试技术 网络安全
2024年甘肃省职业院校技能大赛中职组 “网络安全”赛项竞赛样题-C模块安全事件响应/网络安全数据取证/应用安全
涉及安全事件响应和应用安全测试。需使用Kali对Windows Server2105进行渗透测试,包括服务扫描、DNS信息提取、管理员密码、文件名与内容、图片中单词等。另外,需收集win20230305的服务器端口、页面信息、脚本、登录后信息等。在Linux Server2214上,要获取SSH端口、主机名、内核版本并进行提权操作。网络安全响应针对Server2228,涉及删除后门用户、查找SSH后门时间、恢复环境变量、识别篡改文件格式和矿池钱包地址。最后,对lin20230509进行网站渗透,获取端口号、数据库服务版本、脚本创建时间、页面路径、内核版本和root目录下的flag文件内容
6 0
|
6天前
|
存储 安全 网络安全
构筑安全之盾:云计算环境下的网络安全与信息保护策略
【4月更文挑战第19天】随着云计算技术的飞速发展,企业和个人越来越依赖于云服务来存储、处理和交换数据。然而,这种便利性背后隐藏着潜在的安全风险。本文深入探讨了在云计算背景下,如何通过综合性的安全措施和策略来强化网络安全防护,确保数据的完整性、可用性和机密性。我们将分析当前面临的主要安全挑战,并基于最新的技术进展提出相应的解决方案,以期达到有效防御外部威胁和内部漏洞的目的。
16 4
|
6天前
|
运维 监控 安全
等保合规:保护企业网络安全的必要性与优势
等保,全称为“信息安全等级保护”,是国家强制性标准,要求特定行业和企业通过安全评估确保网络安全。等保涉及物理安全(如门禁、人员管理、设备保护等)、网络安全、主机安全、应用与数据安全、制度与人员安全、系统建设管理及系统运维管理等七个方面,确保信息系统的安全和可靠性。企业进行等保合规是为了满足《网络安全法》等法律法规要求,防止网络数据泄露,避免罚款。等保工作包括定级备案、安全测评、建设整改等,企业需建立良好的安全保护生态,确保网络安全。通过等保,企业能构建有效的安全保障体系,防御系统入侵,保障用户信息,提升故障修复效率,并符合法律义务。