首页 > 系统相关 >Centos7如何配置IPADDR,NETMASK,GATEWAY?

Centos7如何配置IPADDR,NETMASK,GATEWAY?

时间:2023-07-27 23:06:00浏览次数:40  
标签:network 0.0 IPADDR ifup 192.168 Centos7 NETMASK ifdown ens33

1、获取IPADDR、NETMASK:

[root@192 network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.85.139  netmask 255.255.255.0  broadcast 192.168.85.255
        inet6 fe80::11df:c601:5b38:ca41  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:fe:f2:7d  txqueuelen 1000  (Ethernet)
        RX packets 750  bytes 60532 (59.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 500  bytes 94739 (92.5 KiB)
        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 1000  (Local Loopback)
        RX packets 8  bytes 696 (696.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 696 (696.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Centos7如何配置IPADDR,NETMASK,GATEWAY?_NETMASK

2、获取GATEWAY:

[root@192 network-scripts]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.85.2    0.0.0.0         UG    100    0        0 ens33
192.168.85.0    0.0.0.0         255.255.255.0   U     100    0        0 ens33

Centos7如何配置IPADDR,NETMASK,GATEWAY?_IPADDR_02

3、配置IPADDR,NETMASK,GATEWAY:

[root@192 sysconfig]# cd /etc/sysconfig/network-scripts
[root@192 network-scripts]# ls
ifcfg-ens33  ifdown-eth   ifdown-post    ifdown-Team      ifup-aliases  ifup-ipv6   ifup-post    ifup-Team      init.ipv6-global
ifcfg-lo     ifdown-ippp  ifdown-ppp     ifdown-TeamPort  ifup-bnep     ifup-isdn   ifup-ppp     ifup-TeamPort  network-functions
ifdown       ifdown-ipv6  ifdown-routes  ifdown-tunnel    ifup-eth      ifup-plip   ifup-routes  ifup-tunnel    network-functions-ipv6
ifdown-bnep  ifdown-isdn  ifdown-sit     ifup             ifup-ippp     ifup-plusb  ifup-sit     ifup-wireless
vi ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.85.139
NETMASK=255.255.255.0
GATEWAY=192.168.85.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=f3bf2c45-d6af-408e-bcc9-d11b06cae1ad
DEVICE=ens33
ONBOOT=yes

Centos7如何配置IPADDR,NETMASK,GATEWAY?_GATEWAY_03

4、修改完后重启网卡:

systemctl restart network

标签:network,0.0,IPADDR,ifup,192.168,Centos7,NETMASK,ifdown,ens33
From: https://blog.51cto.com/u_15391441/6875062

相关文章

  • PJK-linux安装jenkins(centos7.6)
    1.采用rpm安装的方式去Indexof/jenkins/redhat-stable/|清华大学开源软件镜像站|TsinghuaOpenSourceMirror清华大学镜像站下载rpm包2.在系统中切换到你喜欢的目录将下载的rpm包上传3.rpm安装rpm-ivhjenkins-2.346.3-1.1.noarch.rpm4.修改jenkins配置vim/etc/init.d......
  • centos7关闭防火墙后只有22端口可以telnet的解决方法
    1、问题描述防火墙已经关闭22端口可以telnet其他端口无法telnet2、解决方法注意:下列命令要用root账号/权限执行2.1、开启防火墙systemctlstartfirewalld2.2、添加要开放的端口该命令以8081端口为示例firewall-cmd--add-port=8081/tcp2.3、重新加载防......
  • Centos7安装docker并配置阿里云镜像加速
    前言提示:要安装DockerEngine,您需要一个CentOS7或8的维护版本。不支持或未测试存档版本。该centos-extras库必须启用。默认情况下,此存储库是启用的,但是如果已禁用它,则需要重新启用它。overlay2建议使用存储驱动程序。一、卸载旧版本我们目前现在安装的docker,大多是dockerCE版......
  • Centos7 离线升级openssh到9.3p1
    参考:https://blog.csdn.net/qq_29768197/article/details/125048720参考:https://blog.csdn.net/weixin_46739058/article/details/129189927 1、官方下载地址:http://www.zlib.net/     zlib-1.2.12.tar.gzwget http://www.zlib.net/zlib-1.2.13.tar.gz 2、官方......
  • Linux基础—vmvare安装及centos7安装
    Linux基础#https://zhuanlan.zhihu.com/p/429509333#一什么是操作系统OperatingSystem(操作系统)简称OSWindows,MacOS,Linux都是操作系统#二什么是BootLoader在嵌入式操作系统中,BootLoader是在操作系统内核运行之前运行。可以初始化硬件设备、建立内存空间映射图,从......
  • mysql8.0 centos7 xtrabackup步骤
    mysql8.0centos7xtrabackup步骤wgethttps://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.33-28/binary/redhat/7/x86_64/percona-xtrabackup-80-8.0.33-28.1.el7.x86_64.rpmyuminstallcmakegccgcc-c++libaiolibaio-develauto......
  • centos7使用docker安装sentry
    来源:https://www.likecs.com/show-307736478.html 环境:centos7、docker19基础环境需求*Docker17.05.0+*Compose1.23.0+流程:docker安装-->docker-compose安装-->clone项目-->安装sentry-->启动sentry-->访问验证(可以直接查看安装文档 moreonpremise/README.md )1、s......
  • centos7 openssh升级到9.3.p1
    配置openssh目录cp/etc/ssh/sshd_config/etc/ssh/sshd_config.bakcp/etc/pam.d/sshd/etc/pam.d/sshd.bakmkdir-p/root/opensshcd/root/openssh上传已经制作好的openssh包openssh-9.3p1-1.el7.x86_64.rpmopenssh-clients-9.3p1-1.el7.x86_64.rpmopenssh-server-9.3......
  • mysql5.7 centos7 xtrabackup步骤
    mysql5.7centos7xtrabackup步骤wgethttps://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.28/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.28-1.el7.x86_64.rpmyuminstallcmakegccgcc-c++libaiolibaio-develautomake......
  • CentOS7调整磁盘分区
    进入系统后,使用df-h命令查看分区和磁盘使用情况。此时/home目录的磁盘空间需要移除,全部分给/root目录(也就是cl-root)。df-h  使用fdisk-l查看物理磁盘挂载情况。  调整分区前正常是要备份数据的,可参考如下操作。但是新装系统没有什么数据的情况,可以不要数据,直......