Ubuntu使用apt-get更新时选择IPv4或IPv6通道的方法
时间:2023-03-31 01:34:39
众所周知,Ubuntu可以使用apt-get来获取系统或者软件的更新,并且把这些更新从网络上下载下来安装到电脑上。其实Ubuntu用户还可以选择IPv4或IPv6通道下载这些更新。下面小编就来介绍一下Ubuntu使用apt-get更新时选择IPv4或IPv6通道的方法。
Ubuntu
ForceIPv4:全局强制使用 IPv4 协议下载
ForceIPv6:全局强制使用 IPv6 协议下载
当然,如果要使用 IPv6 的话,需要你的运营商和路由器支持,并在操作系统上进行了正确的配置才行。
方法一:手动指定
apt-get全局使用IPv4示例
1.sudo apt-get -o Acquire::ForceIPv4=true install pkg
2.sudo apt-get -o Acquire::ForceIPv4=true update
3.sudo apt-get -o Acquire::ForceIPv4=true upgrade
4.sudo apt-get -o Acquire::ForceIPv4=true dist-upgrade
5.sudo apt-get -o Acquire::ForceIPv4=true install XXX
apt-get全局使用IPv6示例
1.sudo apt-get -o Acquire::ForceIPv6=true install pkg
2.sudo apt-get -o Acquire::ForceIPv6=true update
3.sudo apt-get -o Acquire::ForceIPv6=true upgrade
4.sudo apt-get -o Acquire::ForceIPv6=true dist-upgrade
5.sudo apt-get -o Acquire::ForceIPv6=true install XXX
方法二:配置Bash别名
如果你不想每次都输得这么麻烦的话,可以直接更改 Bash Shell 的配置文件 ~/.bashrc
## 使用 IPv6 ##
#alias apt-get=‘sudo apt-get -o Acquire::ForceIPv6=true’
## 使用 IPv4 ##
alias apt-get=‘sudo apt-get -o Acquire::ForceIPv4=true’
方法三:创建apt-get配置文件
如果你希望 apt-get 强制使用 IPv6 可以创建如下配置文件
/etc/apt/apt.conf.d/1000-force-ipv6-transport
并将其内容填写上
Acquire::ForceIPv6 “true”;
如果你希望 apt-get 强制使用 IPv4 可以创建如下配置文件
etc/apt/apt.conf.d/1000-force-ipv4-transport
并将其内容填写上
Acquire::ForceIPv4 “true”;
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win10系统还原失败怎么办?Win10还原系统失败解决办法
![](https://img.aspxhome.com/file/2023/26/a221258_0s.png)
详细解释XP主要15个系统进程
WPS文字教程之ET表格文本互转
![](https://img.aspxhome.com/file/2023/5/a165125_0s.jpg)
电脑WPS如何合并不同图形
![](https://img.aspxhome.com/file/2023/2/a184212_0s.jpg)
Word下划线怎么对齐?教你一招(论文/合同封面制作必学技巧)
![](https://img.aspxhome.com/file/2023/4/22554_0s.gif)
excel用函数检查重复项的方法
Word个性化修改艺术字
在word文档中如何添加背景呢?
![](https://img.aspxhome.com/file/2023/2/24182_0s.jpg)
win10找不到gpedit怎么办?gpedit在哪里找?
![](https://img.aspxhome.com/file/2023/6/47176_0s.jpg)
win7任务栏闪烁不定怎么办?
![](https://img.aspxhome.com/file/2023/1/a275171_0s.png)
教你几个将Win10系统降级的简单技巧
![](https://img.aspxhome.com/file/2023/4/a307887_0s.jpg)
Win10 22h2系统重启转圈无法启动解决方法分享
![](https://img.aspxhome.com/file/2023/1/46381_0s.png)
电脑版WPS怎么设置自动保存
![](https://img.aspxhome.com/file/2023/2/a183342_0s.jpg)
使用次坐标轴来改变Excel图表的展现形态的方法
Win11硬盘读写慢怎么办?Win11硬盘读写慢的解决方法
![](https://img.aspxhome.com/file/2023/27/a236397_0s.jpg)
Win7系统无法安装运行软件怎么办 exe文件打不开的解决方法
![](https://img.aspxhome.com/file/2023/4/a307790_0s.jpg)
win10闹钟怎么设置?win10闹钟设置方法范围分享!
![](https://img.aspxhome.com/file/2023/30/a265933_0s.gif)
如何清除windows和office的激活信息
![](https://img.aspxhome.com/file/2023/7/16567_0s.png)
excel快速填充单元格技巧
![](https://img.aspxhome.com/file/2023/7/a141147_0s.jpg)
WPS可爱猫爪的简笔画教程来一波
![](https://img.aspxhome.com/file/2023/0/a185410_0s.jpg)