Cento7配置网络及代理

妖狐艹你老母 2021-12-01 11:50 333阅读 0赞

1、配置网络

编辑网卡配置文件

  1. [root@localhost yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
  2. TYPE=Ethernet
  3. BOOTPROTO=none
  4. DEFROUTE=yes
  5. IPV4_FAILURE_FATAL=no
  6. IPV6INIT=yes
  7. IPV6_AUTOCONF=yes
  8. IPV6_DEFROUTE=yes
  9. IPV6_FAILURE_FATAL=no
  10. NAME=eno16777736
  11. UUID=0fc4b7e3-c161-4644-8121-5c576f1f1018
  12. DEVICE=eno16777736
  13. ONBOOT=yes
  14. DNS1=192.168.163.2
  15. IPADDR=192.168.163.136
  16. PREFIX=24
  17. GATEWAY=192.168.163.2
  18. IPV6_PEERDNS=yes
  19. IPV6_PEERROUTES=yes

2、配置代理

(1)编辑profile文件

  1. [root@localhost yum.repos.d]# vim /etc/profile

#添加Proxy代理信息(其中username和password根据需要填写,若无则不填写)

  1. http_proxy = http://username:password@proxy_ip:port/
  2. https_proxy = http://username:password@proxy_ip:port/
  3. ftp_proxy = http://username:password@proxy_ip:port/
  4. export http_proxy
  5. export https_proxy
  6. export ftp_proxy

#生效配置

  1. source /etc/profile

(2)yum代理设置
编辑yum.conf文件

  1. [root@localhost yum.repos.d]# vim /etc/yum.conf

添加Proxy代理信息

  1. proxy = http://username:password@proxy_ip:port/

(2)wget代理设置
#编辑/wgetrc文件

  1. [root@localhost yum.repos.d]# vim /etc/wgetrc

修改Proxy代理信息

  1. http_proxy=http://username:password@proxy_ip:port/
  2. ftp_proxy=http://username:password@proxy_ip:port/

(4)下载阿里云镜像
进入yum.repos.d目录,备份好原有的镜像。

  1. [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  2. [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

然后执行

  1. [root@localhost yum.repos.d]# yum clean all
  2. [root@localhost yum.repos.d]# yum makecache

至此网络配置、代理配置完成。

发表评论

表情:
评论列表 (有 0 条评论,333人围观)

还没有评论,来说两句吧...

相关阅读