Skip to Content
可编程网络自动化
book

可编程网络自动化

by Jason Edelman, Scott S. Lowe, Matt Oswalt
January 2023
Intermediate to advanced
458 pages
14h 16m
Chinese
Posts & Telecom Press
Content preview from 可编程网络自动化
412
附录
A
LXC
Docker
的共同之处(除了使用相同的底层
Linux
内核结构外)体现在两者在容器
联网的某些方面(这些都是默认设置)。
LXC
Docker
都利用了
veth pa
ir
,将其中一个
veth
接口放在包含容器的网络名称空间,
将另一个接口放在默认的网络名称空间。
LXC
Docker
利用了
veth
对等接口在默认名称空间所附着的
Linux
网桥。默认的
LXC
网桥是
lxcbr0
,默认的
Docker
网桥是
docker0
LXC
Docker
都使用定制的
iptables
规则执行网络地址转换,以实现容器的连通性。
除了
iptables
的使用
,前面已经讨论过所有这些机制,所以你应该对
veth
接口、如何将
veth
接口置入网络名称空间以及使用网桥提供连通性并不陌生。
尽管可以看到
LXC
Docker
存在颇多的相似之处
,但也有不少差异,尤其是在各自的网
络设置方面。下面让我们来仔细了解一下
LXC
Docker
的容器联网配置。
A.4.1
 配置
LXC
联网
LXC
是以每个容器为基础来存储联网配置的。在
Ubuntu
系统(该路径可能视发行版而异)
中,文件
/var/lib/lxc/<container
-name>/config
包含了一些重要的
LXC
联网配置选项。
lxc.network.type
选项控制着容器的联网类型。默认值为
veth
,表示
LXC
使用
veth
pair
。也可以指定
macvlan
,表示
LXC
使用
macvlan
接口。如果使用的是
macvlan
接口,
则可以使用
lxc.network.macvlan.mode ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

弱监督学习实用指南

弱监督学习实用指南

Wee Hyong Tok, Amit Bahree, Senja Filipi
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9787115606181