SlideShare a Scribd company logo
1 of 52
Download to read offline
arpd
arpd
Netlink
overns
Lookup
11.11.11.3
02:42:c0:a8:00:03
overns
11.11.11.5
02:42:c0:a8:00:04
eth0
vxlan1
br0
eth0
GETNEIGH
NFS
Netlink
L2/L3 miss
vethO3
eth1
GETNEIGH
11.11.11.4
02:42:c0:a8:00:04
11.11.11.2
02:42:c0:a8:00:02
eth0
eth0 vxlan1
br0
vethO2
vethO4
L2/L3 miss
eth1
Lookup
vethO5
192.168.104.2 192.168.104.3
bluens
redns
orangens
greenns
FDB
ARP
ARP
FDB
도커 없이 컨테이너 만들기
7편
Sam.0
실습과 함께 완성해보는
시작하기에 앞서 …
본 컨텐츠는 앞편을 보았다고 가정하고 준비되었습니다.
원활한 이해 및 실습을 위하여 앞편을 먼저 보시기를 추천드립니다
네트워크 네임스페이스 3,4편과 오버레이 네트워크(1) 6편에 기초하여
준비되었습니다.
3편 링크 클릭 4편 링크 클릭 6편 링크 클릭
# sudo -Es
실습 계정 (root)
# cd /vagrant
실습 폴더
vagrant + virtual vm
ubuntu 18.04, docker (Vagrantfile)
- ubuntu1804 (기존)
- ubuntu1804-2 (추가)
실습환경
설치 환경
# apt-get -y install python-pip > /dev/null 2>&1
# pip install pyroute2
실습환경 구성 링크
skyns
overns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
12.12.12.4
02:42:c0:a8:00:04
지난 시간에 이어서 네트워크 네임스페이스(skyns)를 추가해 볼까요
eth1
192.168.104.2
vxlan1
br0
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
FDB
ARP
FDB
ARP
eth0
veth1
veth2
컨테이너의 호스트 네트워크는 이렇게 네트워크 네임스페이스로 격리되고
이더넷 페어 쌍으로 브릿지에 연결됩니다
skyns
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
(실습2) skyns 추가
eth1
192.168.104.2
vxlan1
FDB
ARP br0
veth1
skyns
# ip netns add skyns
# ip link add dev veth2 mtu 1450 netns overns type veth peer name eth0 mtu 1450 netns skyns
터미널 #1
(192.168.104.2)
eth0
veth2
overns skyns
pinkns
12.12.12.4
02:42:c0:a8:00:04
12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
FDB
ARP br0
veth1
skyns
# ip netns exec skyns ip link set dev eth0 address 02:42:c0:a8:00:04
# ip netns exec skyns ip addr add dev eth0 12.12.12.4/24
터미널 #1
(192.168.104.2)
eth0
veth2
(실습2) skyns 추가
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
FDB
12.12.12.4
02:42:c0:a8:00:04
ARP br0
veth1
skyns
# ip netns exec overns ip link set veth2 master br0
# ip netns exec overns ip link set veth2 up
# ip netns exec skyns ip link set eth0 up
터미널 #1
(192.168.104.2)
eth0
veth2
(실습2) skyns 추가
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
FDB
ARP br0
veth1
# ip netns exec skyns ping -c 1 12.12.12.2
64 bytes from 12.12.12.2: icmp_seq=3 ttl=64 time=0.073 ms
# ip netns exec pinkns ping -c 1 12.12.12.4
64 bytes from 12.12.12.4: icmp_seq=35 ttl=64 time=0.051 ms
터미널 #1
(192.168.104.2)
eth0
veth2
12.12.12.4
02:42:c0:a8:00:04
(실습2) skyns 추가 12.12.12.4 ← (ping) → 12.12.12.2
Easy ~
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
FDB
ARP br0
veth1
# ip netns exec skyns ping 12.12.12.3
터미널 #1
(192.168.104.2)
eth0
veth2
12.12.12.4
02:42:c0:a8:00:04
(실습2) skyns 추가
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
FDB
ARP
12.12.12.4 → 12.12.12.3
무엇을 더 해주어야 할까요
?
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
br0
veth1
# ip netns exec skyns ping 12.12.12.3
터미널 #1
(192.168.104.2)
eth0
veth2
12.12.12.4
02:42:c0:a8:00:04
(실습2) skyns 추가
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
12.12.12.4 → 12.12.12.3
정답: ARP,FDB 등록
FDB
ARP
FDB
ARP
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
br0
veth1
# ip netns exec skyns ping 12.12.12.3
터미널 #1
(192.168.104.2)
eth0
veth2
12.12.12.4
02:42:c0:a8:00:04
(실습2) skyns 추가
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
FDB
ARP
12.12.12.4 → 12.12.12.3
정답: ARP,FDB 등록
어느쪽 ?
FDB
ARP
엇? ARP 정보만 넣었는데 ping이 가네요?
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
br0
veth1
eth0
veth2
12.12.12.4
02:42:c0:a8:00:04
(실습2) skyns 추가
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
FDB
ARP
터미널 #2 (overns@192.168.104.3)
# nsenter --net=/var/run/netns/overns
# ip neigh add 12.12.12.4 lladdr 02:42:c0:a8:00:04 dev vxlan1
FDB
ARP
# ip netns exec skyns ping 12.12.12.3
. . .
64 bytes from 12.12.12.3: icmp_seq=731 ttl=64 time=0.466 ms
터미널 #1
(192.168.104.2)
# bridge fdb replace 02:42:c0:a8:00:04 dev vxlan1
self dst 192.168.104.2 vni 42 port 4789
## learning된 정보가 있으면 add는 실패하므로 replace
사용
overns skyns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
eth1
192.168.104.2
vxlan1
br0
veth1
eth0
veth2
12.12.12.4
02:42:c0:a8:00:04
(실습2) skyns 추가
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
FDB
ARP
터미널 #2 (overns@192.168.104.3)
FDB
ARP
# ip netns exec skyns ping 12.12.12.3
. . .
64 bytes from 12.12.12.3: icmp_seq=731 ttl=64 time=0.466 ms
터미널 #1
(192.168.104.2)
bridge FDB는 “learning” 되기 때문이죠 :-)
~ But, aging 때문에
fdb entry가 지워지기
때문에 입력해 줍시다
eth1
skyns
overns
pinkns12.12.12.2
02:42:c0:a8:00:02
eth0
12.12.12.4
02:42:c0:a8:00:04
정리해보면 ...
192.168.104.2
vxlan1
br0
eth1
pinkns12.12.12.3
02:42:c0:a8:00:03
192.168.104.3
overns
eth0
veth1
br0
vxlan1
FDB
ARP
eth0
veth1
veth2
(0) overns 와 vxlan1, br0는 노드당 최초 한번만 생성
컨테이너 추가는 (1) ~ (3) 반복
(1) 컨테이너 생성
(2) veth를 br0에 연결
(3) ARP, FDB에 정보등록
FDB
ARP
(1)
(2)
(3)
동적으로 컨테이너를 추가해 봅시다
(0) overns 와 vxlan1, br0는 노드당 최초 한번만 생성 → create_overlay.sh
(1) 컨테이너 생성
(2) veth를 br0에 연결
(3) ARP, FDB에 정보등록 → arpd.py
→ attach_ctn.sh
실습 스크립트 링크 클릭
Lookup
11.11.11.3
02:42:c0:a8:00:03
overns
Netlink
11.11.11.5
02:42:c0:a8:00:04
Dynamic Overlay Network 완성할 그림
eth0
vxlan1
br0
eth0
FDB
ARP
NFS
Lookup
Netlink
arpd
L2/L3 miss
GETNEIGH
vethO3
eth1
overns
GETNEIGH
11.11.11.4
02:42:c0:a8:00:04
11.11.11.2
02:42:c0:a8:00:02
eth0
eth0 vxlan1
br0
vethO2
vethO4
FDB
ARP
L2/L3 miss
eth1
vethO5
arpd
192.168.104.2 192.168.104.3
bluens
redns
orangens
greenns
Dynamic Overlay Network
Netlink
User space
Kernel space
ARP
Cache
Cache arpd
neigh_app_ns neigh_app_notify
Neighbor
layer
RTN_GETNEIGH RTN_NEWNEIGH
RTNL (RTNetlink)를 이용한 arp table, bridge fdb 동적 갱신
~ arpd (*pyroute2)가 L2 miss, L3miss 이벤트를 catch하여 arp table, fdb table 갱신
Netlink
https://man7.org/linux/man-pages/man7/netlink.7.html
Netlink는 커널과 유저스페이스 프로세스 사이에서 정보교환을 하는데 사용됨
● communication between kernel and user space
● socket-based interface
● datagram-oriented service
● netlink_family selects the kernel module or netlink group to communicate with
“User space 와 Kernel space 간의 불편한 ioctl 통신방법에 대한 좀 더 유연한 대안으로 만들어짐”
Netlink Families
https://man7.org/linux/man-pages/man7/netlink.7.html
커널 내 여러 컴포넌트들과의 통신을 위한 다양한 프로토콜들 (families)로 구성
● NETLINK_ROUTE
● NETLINK_USERSOCK
● NETLINK_FIREWALL
● NETLINK_SOCK_DIAG
● NETLINK_INET_DIAG
● NETLINK_NETFILTER
● NETLINK_SELINUX
● NETLINK_W1
● NETLINK_NFLOG
● NETLINK_XFRM
● NETLINK_ISCSI
● NETLINK_AUDIT
● … 그외 다수 ...
Netlink Families
https://man7.org/linux/man-pages/man7/netlink.7.html
커널 내 여러 컴포넌트들과의 통신을 위한 다양한 프로토콜들 (families)로 구성
● NETLINK_ROUTE
● NETLINK_USERSOCK
● NETLINK_FIREWALL
● NETLINK_SOCK_DIAG
● NETLINK_INET_DIAG
● NETLINK_NETFILTER
● NETLINK_SELINUX
● NETLINK_W1
● NETLINK_NFLOG
● NETLINK_XFRM
● NETLINK_ISCSI
● NETLINK_AUDIT
● … 그외 다수 ...
RTNETLINK (RTNL)
라우팅과 링크 계층의 설정을 위한 인터페이스
● 커널의 라우팅 테이블을 읽거나 수정
● 커널과 커뮤니케이션하는 창구 역할
● 네트워크 제어를 제공
○ n/w routes, ip addresses, neighbor setups, queueing disciplines, traffic classes, …
○ NETLINK_ROUTE sockets 을 통해서 제어
● based on netlink messages
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
RTNETLINK (RTNL)
extern rtnl_register(
int protocol,
int msgtype,
rtnl_doit_func,
rtnl_dumpit_func,
rtnl_calcit_func
);
리눅스 커널네트워킹 (라미로젠 저/강광훈 역,위키북스) p.23 ~ 24
Register message callback
추가/삭제/수정
정보검색
버퍼 사이즈
계산
RTNETLINK Message Types
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
LINK : network interface
ADDR : IP address
ROUTE : routing information
NEIGH : neighbor table (or arp table)
RULE : routing rule
QDISC : queueing discipline
TCLASS : traffic class
TFILTER : traffic filter
CRD (create/read/delete) 제공
RTNETLINK Message Types
● RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK
● RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR
● RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE
● RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH
● RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE
● RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC
● RTM_NEWTCLASS, RTM_DELTCLASS, RTM_GETTCLASS
● RTM_NEWTFILTER, RTM_DELTFILTER, RTM_GETTFILTER
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
RTNETLINK Message Types
● RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK
● RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR
● RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE
● RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH
● RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE
● RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC
● RTM_NEWTCLASS, RTM_DELTCLASS, RTM_GETTCLASS
● RTM_NEWTFILTER, RTM_DELTFILTER, RTM_GETTFILTER
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
RTM_*NEIGH CRD for neighbor table ( or arp table)
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
struct ndmsg {
unsigned char ndm_family;
int ndm_ifindex; /* Interface index */
__u16 ndm_state; /* State */
__u8 ndm_flags; /* Flags */
__u8 ndm_type;
};
struct nda_cacheinfo {
__u32 ndm_confirmed;
__u32 ndm_used;
__u32 ndm_updated;
__u32 ndm_refcnt;
};
ndmsg (neighbor discovery message) 구조체
ndm_state
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
ndmsg (neighbor discovery message)
NUD_INCOMPLETE a currently resolving cache entry
NUD_REACHABLE a confirmed working cache entry
NUD_STALE an expired cache entry
NUD_DELAY an entry waiting for a timer
NUD_PROBE a cache entry that is currently reprobed
NUD_FAILED an invalid cache entry
NUD_NOARP a device with no destination cache
NUD_PERMANENT a static entry
rta_type
https://man7.org/linux/man-pages/man7/rtnetlink.7.html
NDA_UNSPEC unknown type
NDA_DST a neighbor cache n/w layer destination address
NDA_LLADDR a neighbor cache link layer destination address
NDA_CACHEINFO cache statistics
Pyroute2
https://pypi.org/project/pyroute2/
Pyroute2 is a pure Python netlink library.
… The library was started as an RTNL protocol
implementation, so the name is pyroute2, but now it
supports many netlink protocols
(실습3) Dynamic Overlay Network 실습준비
# cd /vagrant
# tar -xf overlaynet.tar
# tree /vagrant/overlaynet
netlink event를 catch하여 arp daemon. arp/fdb 정보 갱신
container를 생성하고 br0 (bridge)에 연결, mac/ip 주소
등록
app_solicit 활성여부 체크 (사용안함) * vxlan l2miss/l3miss 활성
overns 및 bridge/vxlan 구성
container 생성, bridge 연결, mac/ip 주소 등록 (NFS)
초기화. 모든 netns 및 storage/{arp,fdb} 삭제
준비물 : overlaynet.tar
NFS. 클러스터 내 모든 컨테이너의 arp/fdb 공유 저장소
지금부터 실습 경로는 /vagrant/overlaynet 입니다.
실습 스크립트 링크 참고
(실습3) Dynamic Overlay Network
NFS
eth1
eth1
192.168.104.2 192.168.104.3
기존 네임스페이스 정리
# cd /vagrant/overlaynet
# ./reset.sh
# ip netns
터미널 #1
(192.168.104.2)
+ 터미널 #2 (192.168.104.3)
overns
(실습3) Dynamic Overlay Network
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
overns 생성
# ./create_overlay.sh
터미널 #1
(192.168.104.2)
+ 터미널 #2 (192.168.104.3)
NFS
11.11.11.3
02:42:c0:a8:00:03
overns
(실습3) Dynamic Overlay Network
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
컨테이너 생성
터미널 #1
(192.168.104.2)
터미널 #2
(192.168.104.3)
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
vethO3
redns greenns
NFS
# ./attach_ctn.sh redns 2 # ./attach_ctn.sh greenns 3
네임스페이스
주소 postfix
overns
(실습3) Dynamic Overlay Network
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
컨테이너 생성
# ./attach_ctn.sh redns 2
# tree
터미널 #1
(192.168.104.2)
# ./attach_ctn.sh greenns 3
# tree
터미널 #2
(192.168.104.3)
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
11.11.11.3
02:42:c0:a8:00:03
vethO3
attach_ctn.sh attach_ctn.sh
create
write
write
create
redns greenns
NFS
tree
overns
(실습3) Dynamic Overlay Network
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
컨테이너 생성
# ip netns exec redns ping -c 1 11.11.11.1
터미널 #1
(192.168.104.2)
# ip netns exec greenns ping -c 1 11.11.11.1
터미널 #2
(192.168.104.3)
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
11.11.11.3
02:42:c0:a8:00:03
vethO3
redns greenns
NFS
ping ping
overns
(실습3) Dynamic Overlay Network
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
Check L2L3miss
# ip netns exec redns ping 11.11.11.3
터미널 #1
(192.168.104.2)
# ./l2l3miss.py
터미널 #2
(192.168.104.3)
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
# ./l2l3miss.py
터미널 #3
(192.168.104.2)
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
(실습3) Dynamic Overlay Network L3miss
# ip netns exec redns ping -c 1 11.11.11.3
터미널 #1
(192.168.104.2)
# ./l2l3miss.py
터미널 #2
(192.168.104.3)
# ./l2l3miss.py
DEBUG:root:Received an event: RTM_GETNEIGH
DEBUG:root:------------ ndmsg start ------------
DEBUG:root:Family: AF_INET
DEBUG:root:Interface vxlan1 index: 3
DEBUG:root:State: NUD_STALE
DEBUG:root:Flags: 0
DEBUG:root:Type: RTN_UNICAST
DEBUG:root:------------ ndmsg end --------------
INFO:root:L3Miss on vxlan1: Who has IP: 11.11.11.3? Check arp table on overns
터미널 #3
(192.168.104.2)
L2L3
arp 등록하세요
(실습3) Dynamic Overlay Network L3miss
# tree storage/arp
# cat storage/arp/11.11.11.3
02:42:c0:a8:00:03
터미널 #3
(192.168.104.2)
tree storage/arp
INFO:root:L3Miss on vxlan1: Who has IP: 11.11.11.3? Check arp table on overns
NFS
(실습3) Dynamic Overlay Network L3miss → arp table 등록
# ip netns exec overns ip neigh add 11.11.11.3 lladdr 02:42:c0:a8:00:03 dev vxlan1
터미널 #1
(192.168.104.2)
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
ARP
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
✍
02:42:c0:a8:00:03
(실습3) Dynamic Overlay Network L3miss OK → L2miss 발생
# ip netns exec redns ping -c 1 11.11.11.3
터미널 #1
(192.168.104.2)
# ./l2l3miss.py
DEBUG:root:Received an event: RTM_GETNEIGH
DEBUG:root:------------ ndmsg start ------------
DEBUG:root:Family: AF_INET
DEBUG:root:Interface vxlan1 index: 3
DEBUG:root:State: NUD_STALE
DEBUG:root:Flags: 0
DEBUG:root:Type: RTN_UNICAST
DEBUG:root:------------ ndmsg end --------------
INFO:root:L2Miss on vxlan1: Who has MAC: 02:42:c0:a8:00:03? Check bridge fdb on overns
터미널 #3
(192.168.104.2)
L2L3
fdb 등록하세요
(실습3) Dynamic Overlay Network L3miss
# tree storage/arp
# cat storage/arp/02:42:c0:a8:00:03
192.168.104.3
터미널 #3
(192.168.104.2)
tree storage/fdb
NFS
INFO:root:L2Miss on vxlan1: Who has MAC: 02:42:c0:a8:00:03? Check bridge fdb on overns
(실습3) Dynamic Overlay Network L2miss → bridge fdb 등록
# ip netns exec overns bridge fdb replace 02:42:c0:a8:00:03 dev vxlan1 self dst 192.168.104.3 vni 42 port 4789
터미널 #1
(192.168.104.2)
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
redns
FDB
ARP
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
✍
192.168.104.3
NFS
(실습3) Dynamic Overlay Network L2miss OK → 수신측 L2miss
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
FDB
ARP
# ip netns exec redns ping 11.11.11.3
터미널 #1
(192.168.104.2)
# ./l2l3miss.py
. . .
INFO:root:L3Miss on vxlan1: Who has IP: 11.11.11.2?
Check arp table on overns
터미널 #2
(192.168.104.3)
# ./l2l3miss.py
터미널 #3
(192.168.104.2)
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
greenns
(실습3) Dynamic Overlay Network 수신측 L2miss ~ arp 등록
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
FDB
ARP
# ip netns exec redns ping -c 1 11.11.11.3
터미널 #1
(192.168.104.2)
# ip netns exec overns ip neigh add 11.11.11.2 lladdr
02:42:c0:a8:00:02 dev vxlan1
터미널 #2
(192.168.104.3)
# ./l2l3miss.py
터미널 #3
(192.168.104.2)
ARP
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
✍
02:42:c0:a8:00:02
(실습3) Dynamic Overlay Network 수신측 L2miss ~ OK
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
FDB
ARP
# ip netns exec redns ping -c 1 11.11.11.3
터미널 #1
(192.168.104.2)
# ip netns exec overns bridge fdb replace
02:42:c0:a8:00:02 dev vxlan1 self dst 192.168.104.2 vni
42 port 4789
터미널 #2
(192.168.104.3)
# ./l2l3miss.py
터미널 #3
(192.168.104.2)
FDB
ARP
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
✍
192.168.104.2
(실습3) Dynamic Overlay Network
red ← ping → green OK
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
FDB
ARP
# ip netns exec redns ping -c 1 11.11.11.3
터미널 #1
(192.168.104.2)
# ip netns exec overns bridge fdb replace
02:42:c0:a8:00:02 dev vxlan1 self dst 192.168.104.2 vni
42 port 4789
터미널 #2
(192.168.104.3)
# ./l2l3miss.py
터미널 #3
(192.168.104.2)
FDB
ARP
Netlink
L2/L3 miss
Netlink
L2/L3 miss
L2L3
GETNEIGH
L2L3
GETNEIGH
(실습3) Dynamic Overlay Network
arpd를 이용하여 동적으로 arp,fdb를 등록해봅시다
overns
vxlan1
br0
eth1
overns
vxlan1
br0
eth1
192.168.104.2 192.168.104.3
11.11.11.2
02:42:c0:a8:00:02
eth0 vethO2 eth0
greenns
11.11.11.3
02:42:c0:a8:00:03
vethO3
NFS
redns
FDB
ARP
#
터미널 #1
(192.168.104.2)
#
터미널 #2
(192.168.104.3)
# ./arpd.py
터미널 #3
(192.168.104.2)
FDB
ARP
L2/L3 miss
Netlink
L2/L3 miss
# ./arpd.py
터미널 #4
(192.168.104.3)
arpd
GETNEIGH
Netlink
arpd
GETNEIGH
arpd
arpd
Netlink
overns
Lookup
11.11.11.3
02:42:c0:a8:00:03
overns
11.11.11.5
02:42:c0:a8:00:04
(실습3) Dynamic Overlay Network
eth0
vxlan1
br0
eth0
GETNEIGH
FDB
ARP
NFS
Netlink
L2/L3 miss
vethO3
eth1
GETNEIGH
11.11.11.4
02:42:c0:a8:00:04
11.11.11.2
02:42:c0:a8:00:02
eth0
eth0 vxlan1
br0
vethO2
vethO4
FDB
ARP
L2/L3 miss
eth1
Lookup
vethO5
192.168.104.2 192.168.104.3
bluens
redns
orangens
greenns
arpd를 이용하여 동적으로 arp,fdb를 등록해봅시다
# ./attach_ctn.sh bluens 4
터미널 #1
(192.168.104.2)
# ./attach_ctn.sh orangens 5
터미널 #2
(192.168.104.3)
# ./arpd.py
터미널 #3
(192.168.104.2)
# ./arpd.py
터미널 #4
(192.168.104.3)
attach_ctn.sh attach_ctn.sh
(실습3) Dynamic Overlay Network
# ip netns exec bluens ping -c 3 11.11.11.5
# ip netns exec bluens ping -c 3 11.11.11.3
터미널 #1
(192.168.104.2)
# ip netns exec orangens ping -c 3 11.11.11.4
# ip netns exec orangens ping -c 3 11.11.11.2
터미널 #2
(192.168.104.3)
Good Luck ~ :-)
arpd
arpd
Netlink
overns
Lookup
11.11.11.3
02:42:c0:a8:00:03
overns
11.11.11.5
02:42:c0:a8:00:04
eth0
vxlan1
br0
eth0
GETNEIGH
NFS
Netlink
L2/L3 miss
vethO3
eth1
GETNEIGH
11.11.11.4
02:42:c0:a8:00:04
11.11.11.2
02:42:c0:a8:00:02
eth0
eth0 vxlan1
br0
vethO2
vethO4
L2/L3 miss
eth1
Lookup
vethO5
192.168.104.2 192.168.104.3
bluens
redns
orangens
greenns
FDB
ARP
ARP
FDB
(Homework)
노드 (192.168.104.4)를 추가하고 해당 노드에 pinkns, skyns 를 생성하여 다른 노드의 컨테이너와
통신해보세요
eth0
Host
routes
iptables
lo
eth0
Container 11.11.11.2
routes
iptables
lo
arp table
bridge fdb
arp table
bridge fdb
eth0
Container 11.11.11.3
routes
iptables
lo
arp table
bridge fdb
이제 여러분은 분산 환경에서 가상 네트워크를 구축하실 수 있습니다.
오늘 배운 vxlan을 이용한 오버레이 네트워크 구축 방식은
쿠버네티스 네트워크 플러그인 중 하나인 Flannel 에서 사용하는 방법입니다.
bridge vxlan
END
목차 보기

More Related Content

What's hot

Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
 
Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Etsuji Nakai
 
Docker - container and lightweight virtualization
Docker - container and lightweight virtualization Docker - container and lightweight virtualization
Docker - container and lightweight virtualization Sim Janghoon
 
Using cgroups in docker container
Using cgroups in docker containerUsing cgroups in docker container
Using cgroups in docker containerVinay Jindal
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentMohammed Farrag
 
Small, Simple, and Secure: Alpine Linux under the Microscope
Small, Simple, and Secure: Alpine Linux under the MicroscopeSmall, Simple, and Secure: Alpine Linux under the Microscope
Small, Simple, and Secure: Alpine Linux under the MicroscopeDocker, Inc.
 
Introduction to eBPF and XDP
Introduction to eBPF and XDPIntroduction to eBPF and XDP
Introduction to eBPF and XDPlcplcp1
 
GlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack IntegrationGlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack IntegrationEtsuji Nakai
 
Linux Network commands
Linux Network commandsLinux Network commands
Linux Network commandsHanan Nmr
 
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Jérôme Petazzoni
 
Storage based on_openstack_mariocho
Storage based on_openstack_mariochoStorage based on_openstack_mariocho
Storage based on_openstack_mariochoMario Cho
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureJérôme Petazzoni
 
Muduo network library
Muduo network libraryMuduo network library
Muduo network libraryShuo Chen
 
A Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiA Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiJian-Hong Pan
 
Container Torture: Run any binary, in any container
Container Torture: Run any binary, in any containerContainer Torture: Run any binary, in any container
Container Torture: Run any binary, in any containerDocker, Inc.
 
Software Packaging for Cross OS Distribution
Software Packaging for Cross OS DistributionSoftware Packaging for Cross OS Distribution
Software Packaging for Cross OS DistributionJian-Hong Pan
 

What's hot (20)

Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 
Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7
 
Alta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/LinuxAlta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/Linux
 
Vagrant
VagrantVagrant
Vagrant
 
Docker - container and lightweight virtualization
Docker - container and lightweight virtualization Docker - container and lightweight virtualization
Docker - container and lightweight virtualization
 
Using cgroups in docker container
Using cgroups in docker containerUsing cgroups in docker container
Using cgroups in docker container
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
 
Small, Simple, and Secure: Alpine Linux under the Microscope
Small, Simple, and Secure: Alpine Linux under the MicroscopeSmall, Simple, and Secure: Alpine Linux under the Microscope
Small, Simple, and Secure: Alpine Linux under the Microscope
 
Introduction to eBPF and XDP
Introduction to eBPF and XDPIntroduction to eBPF and XDP
Introduction to eBPF and XDP
 
GlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack IntegrationGlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack Integration
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Linux Network commands
Linux Network commandsLinux Network commands
Linux Network commands
 
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
 
Storage based on_openstack_mariocho
Storage based on_openstack_mariochoStorage based on_openstack_mariocho
Storage based on_openstack_mariocho
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and Azure
 
Muduo network library
Muduo network libraryMuduo network library
Muduo network library
 
packaging
packagingpackaging
packaging
 
A Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiA Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry Pi
 
Container Torture: Run any binary, in any container
Container Torture: Run any binary, in any containerContainer Torture: Run any binary, in any container
Container Torture: Run any binary, in any container
 
Software Packaging for Cross OS Distribution
Software Packaging for Cross OS DistributionSoftware Packaging for Cross OS Distribution
Software Packaging for Cross OS Distribution
 

Similar to Make container without_docker_7

Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Andriy Berestovskyy
 
Tuning TCP and NGINX on EC2
Tuning TCP and NGINX on EC2Tuning TCP and NGINX on EC2
Tuning TCP and NGINX on EC2Chartbeat
 
[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network TroubleshootingOpen Source Consulting
 
Kernel Recipes 2014 - NDIV: a low overhead network traffic diverter
Kernel Recipes 2014 - NDIV: a low overhead network traffic diverterKernel Recipes 2014 - NDIV: a low overhead network traffic diverter
Kernel Recipes 2014 - NDIV: a low overhead network traffic diverterAnne Nicolas
 
OSMC 2017 | SNMP explained by Rob Hassing
OSMC 2017 | SNMP explained by Rob HassingOSMC 2017 | SNMP explained by Rob Hassing
OSMC 2017 | SNMP explained by Rob HassingNETWAYS
 
IPTABLES Introduction
IPTABLES IntroductionIPTABLES Introduction
IPTABLES IntroductionHungWei Chiu
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking ExplainedThomas Graf
 
Anatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoortersAnatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoortersSadique Puthen
 
Linux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guideLinux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guidejasembo
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeDocker, Inc.
 
Using GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnlUsing GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnlKentaro Ebisawa
 
Spying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profitSpying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profitAndrea Righi
 
Andrea Righi - Spying on the Linux kernel for fun and profit
Andrea Righi - Spying on the Linux kernel for fun and profitAndrea Righi - Spying on the Linux kernel for fun and profit
Andrea Righi - Spying on the Linux kernel for fun and profitlinuxlab_conf
 
Advanced RAC troubleshooting: Network
Advanced RAC troubleshooting: NetworkAdvanced RAC troubleshooting: Network
Advanced RAC troubleshooting: NetworkRiyaj Shamsudeen
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioHajime Tazaki
 
Playing BBR with a userspace network stack
Playing BBR with a userspace network stackPlaying BBR with a userspace network stack
Playing BBR with a userspace network stackHajime Tazaki
 

Similar to Make container without_docker_7 (20)

Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)
 
Tuning TCP and NGINX on EC2
Tuning TCP and NGINX on EC2Tuning TCP and NGINX on EC2
Tuning TCP and NGINX on EC2
 
MPLS LAB Practice Vol.1.pdf
MPLS LAB Practice Vol.1.pdfMPLS LAB Practice Vol.1.pdf
MPLS LAB Practice Vol.1.pdf
 
[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting
 
Kernel Recipes 2014 - NDIV: a low overhead network traffic diverter
Kernel Recipes 2014 - NDIV: a low overhead network traffic diverterKernel Recipes 2014 - NDIV: a low overhead network traffic diverter
Kernel Recipes 2014 - NDIV: a low overhead network traffic diverter
 
OSMC 2017 | SNMP explained by Rob Hassing
OSMC 2017 | SNMP explained by Rob HassingOSMC 2017 | SNMP explained by Rob Hassing
OSMC 2017 | SNMP explained by Rob Hassing
 
Ltsp talk
Ltsp talkLtsp talk
Ltsp talk
 
IPTABLES Introduction
IPTABLES IntroductionIPTABLES Introduction
IPTABLES Introduction
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
Anatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoortersAnatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoorters
 
Linux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guideLinux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guide
 
netLec5.pdf
netLec5.pdfnetLec5.pdf
netLec5.pdf
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to Practice
 
Using GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnlUsing GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnl
 
Spying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profitSpying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profit
 
Andrea Righi - Spying on the Linux kernel for fun and profit
Andrea Righi - Spying on the Linux kernel for fun and profitAndrea Righi - Spying on the Linux kernel for fun and profit
Andrea Righi - Spying on the Linux kernel for fun and profit
 
Advanced RAC troubleshooting: Network
Advanced RAC troubleshooting: NetworkAdvanced RAC troubleshooting: Network
Advanced RAC troubleshooting: Network
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osio
 
Playing BBR with a userspace network stack
Playing BBR with a userspace network stackPlaying BBR with a userspace network stack
Playing BBR with a userspace network stack
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Make container without_docker_7

  • 1. arpd arpd Netlink overns Lookup 11.11.11.3 02:42:c0:a8:00:03 overns 11.11.11.5 02:42:c0:a8:00:04 eth0 vxlan1 br0 eth0 GETNEIGH NFS Netlink L2/L3 miss vethO3 eth1 GETNEIGH 11.11.11.4 02:42:c0:a8:00:04 11.11.11.2 02:42:c0:a8:00:02 eth0 eth0 vxlan1 br0 vethO2 vethO4 L2/L3 miss eth1 Lookup vethO5 192.168.104.2 192.168.104.3 bluens redns orangens greenns FDB ARP ARP FDB 도커 없이 컨테이너 만들기 7편 Sam.0 실습과 함께 완성해보는
  • 2. 시작하기에 앞서 … 본 컨텐츠는 앞편을 보았다고 가정하고 준비되었습니다. 원활한 이해 및 실습을 위하여 앞편을 먼저 보시기를 추천드립니다 네트워크 네임스페이스 3,4편과 오버레이 네트워크(1) 6편에 기초하여 준비되었습니다. 3편 링크 클릭 4편 링크 클릭 6편 링크 클릭
  • 3. # sudo -Es 실습 계정 (root) # cd /vagrant 실습 폴더 vagrant + virtual vm ubuntu 18.04, docker (Vagrantfile) - ubuntu1804 (기존) - ubuntu1804-2 (추가) 실습환경 설치 환경 # apt-get -y install python-pip > /dev/null 2>&1 # pip install pyroute2 실습환경 구성 링크
  • 4. skyns overns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 12.12.12.4 02:42:c0:a8:00:04 지난 시간에 이어서 네트워크 네임스페이스(skyns)를 추가해 볼까요 eth1 192.168.104.2 vxlan1 br0 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 FDB ARP FDB ARP eth0 veth1 veth2 컨테이너의 호스트 네트워크는 이렇게 네트워크 네임스페이스로 격리되고 이더넷 페어 쌍으로 브릿지에 연결됩니다 skyns
  • 5. overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 (실습2) skyns 추가 eth1 192.168.104.2 vxlan1 FDB ARP br0 veth1 skyns # ip netns add skyns # ip link add dev veth2 mtu 1450 netns overns type veth peer name eth0 mtu 1450 netns skyns 터미널 #1 (192.168.104.2) eth0 veth2
  • 6. overns skyns pinkns 12.12.12.4 02:42:c0:a8:00:04 12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 FDB ARP br0 veth1 skyns # ip netns exec skyns ip link set dev eth0 address 02:42:c0:a8:00:04 # ip netns exec skyns ip addr add dev eth0 12.12.12.4/24 터미널 #1 (192.168.104.2) eth0 veth2 (실습2) skyns 추가
  • 7. overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 FDB 12.12.12.4 02:42:c0:a8:00:04 ARP br0 veth1 skyns # ip netns exec overns ip link set veth2 master br0 # ip netns exec overns ip link set veth2 up # ip netns exec skyns ip link set eth0 up 터미널 #1 (192.168.104.2) eth0 veth2 (실습2) skyns 추가
  • 8. overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 FDB ARP br0 veth1 # ip netns exec skyns ping -c 1 12.12.12.2 64 bytes from 12.12.12.2: icmp_seq=3 ttl=64 time=0.073 ms # ip netns exec pinkns ping -c 1 12.12.12.4 64 bytes from 12.12.12.4: icmp_seq=35 ttl=64 time=0.051 ms 터미널 #1 (192.168.104.2) eth0 veth2 12.12.12.4 02:42:c0:a8:00:04 (실습2) skyns 추가 12.12.12.4 ← (ping) → 12.12.12.2 Easy ~
  • 9. overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 FDB ARP br0 veth1 # ip netns exec skyns ping 12.12.12.3 터미널 #1 (192.168.104.2) eth0 veth2 12.12.12.4 02:42:c0:a8:00:04 (실습2) skyns 추가 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 FDB ARP 12.12.12.4 → 12.12.12.3 무엇을 더 해주어야 할까요 ?
  • 10. overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 br0 veth1 # ip netns exec skyns ping 12.12.12.3 터미널 #1 (192.168.104.2) eth0 veth2 12.12.12.4 02:42:c0:a8:00:04 (실습2) skyns 추가 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 12.12.12.4 → 12.12.12.3 정답: ARP,FDB 등록 FDB ARP FDB ARP
  • 11. overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 br0 veth1 # ip netns exec skyns ping 12.12.12.3 터미널 #1 (192.168.104.2) eth0 veth2 12.12.12.4 02:42:c0:a8:00:04 (실습2) skyns 추가 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 FDB ARP 12.12.12.4 → 12.12.12.3 정답: ARP,FDB 등록 어느쪽 ? FDB ARP
  • 12. 엇? ARP 정보만 넣었는데 ping이 가네요? overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 br0 veth1 eth0 veth2 12.12.12.4 02:42:c0:a8:00:04 (실습2) skyns 추가 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 FDB ARP 터미널 #2 (overns@192.168.104.3) # nsenter --net=/var/run/netns/overns # ip neigh add 12.12.12.4 lladdr 02:42:c0:a8:00:04 dev vxlan1 FDB ARP # ip netns exec skyns ping 12.12.12.3 . . . 64 bytes from 12.12.12.3: icmp_seq=731 ttl=64 time=0.466 ms 터미널 #1 (192.168.104.2)
  • 13. # bridge fdb replace 02:42:c0:a8:00:04 dev vxlan1 self dst 192.168.104.2 vni 42 port 4789 ## learning된 정보가 있으면 add는 실패하므로 replace 사용 overns skyns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 eth1 192.168.104.2 vxlan1 br0 veth1 eth0 veth2 12.12.12.4 02:42:c0:a8:00:04 (실습2) skyns 추가 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 FDB ARP 터미널 #2 (overns@192.168.104.3) FDB ARP # ip netns exec skyns ping 12.12.12.3 . . . 64 bytes from 12.12.12.3: icmp_seq=731 ttl=64 time=0.466 ms 터미널 #1 (192.168.104.2) bridge FDB는 “learning” 되기 때문이죠 :-) ~ But, aging 때문에 fdb entry가 지워지기 때문에 입력해 줍시다
  • 14. eth1 skyns overns pinkns12.12.12.2 02:42:c0:a8:00:02 eth0 12.12.12.4 02:42:c0:a8:00:04 정리해보면 ... 192.168.104.2 vxlan1 br0 eth1 pinkns12.12.12.3 02:42:c0:a8:00:03 192.168.104.3 overns eth0 veth1 br0 vxlan1 FDB ARP eth0 veth1 veth2 (0) overns 와 vxlan1, br0는 노드당 최초 한번만 생성 컨테이너 추가는 (1) ~ (3) 반복 (1) 컨테이너 생성 (2) veth를 br0에 연결 (3) ARP, FDB에 정보등록 FDB ARP (1) (2) (3)
  • 15. 동적으로 컨테이너를 추가해 봅시다 (0) overns 와 vxlan1, br0는 노드당 최초 한번만 생성 → create_overlay.sh (1) 컨테이너 생성 (2) veth를 br0에 연결 (3) ARP, FDB에 정보등록 → arpd.py → attach_ctn.sh 실습 스크립트 링크 클릭
  • 16. Lookup 11.11.11.3 02:42:c0:a8:00:03 overns Netlink 11.11.11.5 02:42:c0:a8:00:04 Dynamic Overlay Network 완성할 그림 eth0 vxlan1 br0 eth0 FDB ARP NFS Lookup Netlink arpd L2/L3 miss GETNEIGH vethO3 eth1 overns GETNEIGH 11.11.11.4 02:42:c0:a8:00:04 11.11.11.2 02:42:c0:a8:00:02 eth0 eth0 vxlan1 br0 vethO2 vethO4 FDB ARP L2/L3 miss eth1 vethO5 arpd 192.168.104.2 192.168.104.3 bluens redns orangens greenns
  • 17. Dynamic Overlay Network Netlink User space Kernel space ARP Cache Cache arpd neigh_app_ns neigh_app_notify Neighbor layer RTN_GETNEIGH RTN_NEWNEIGH RTNL (RTNetlink)를 이용한 arp table, bridge fdb 동적 갱신 ~ arpd (*pyroute2)가 L2 miss, L3miss 이벤트를 catch하여 arp table, fdb table 갱신
  • 18. Netlink https://man7.org/linux/man-pages/man7/netlink.7.html Netlink는 커널과 유저스페이스 프로세스 사이에서 정보교환을 하는데 사용됨 ● communication between kernel and user space ● socket-based interface ● datagram-oriented service ● netlink_family selects the kernel module or netlink group to communicate with “User space 와 Kernel space 간의 불편한 ioctl 통신방법에 대한 좀 더 유연한 대안으로 만들어짐”
  • 19. Netlink Families https://man7.org/linux/man-pages/man7/netlink.7.html 커널 내 여러 컴포넌트들과의 통신을 위한 다양한 프로토콜들 (families)로 구성 ● NETLINK_ROUTE ● NETLINK_USERSOCK ● NETLINK_FIREWALL ● NETLINK_SOCK_DIAG ● NETLINK_INET_DIAG ● NETLINK_NETFILTER ● NETLINK_SELINUX ● NETLINK_W1 ● NETLINK_NFLOG ● NETLINK_XFRM ● NETLINK_ISCSI ● NETLINK_AUDIT ● … 그외 다수 ...
  • 20. Netlink Families https://man7.org/linux/man-pages/man7/netlink.7.html 커널 내 여러 컴포넌트들과의 통신을 위한 다양한 프로토콜들 (families)로 구성 ● NETLINK_ROUTE ● NETLINK_USERSOCK ● NETLINK_FIREWALL ● NETLINK_SOCK_DIAG ● NETLINK_INET_DIAG ● NETLINK_NETFILTER ● NETLINK_SELINUX ● NETLINK_W1 ● NETLINK_NFLOG ● NETLINK_XFRM ● NETLINK_ISCSI ● NETLINK_AUDIT ● … 그외 다수 ...
  • 21. RTNETLINK (RTNL) 라우팅과 링크 계층의 설정을 위한 인터페이스 ● 커널의 라우팅 테이블을 읽거나 수정 ● 커널과 커뮤니케이션하는 창구 역할 ● 네트워크 제어를 제공 ○ n/w routes, ip addresses, neighbor setups, queueing disciplines, traffic classes, … ○ NETLINK_ROUTE sockets 을 통해서 제어 ● based on netlink messages https://man7.org/linux/man-pages/man7/rtnetlink.7.html
  • 22. RTNETLINK (RTNL) extern rtnl_register( int protocol, int msgtype, rtnl_doit_func, rtnl_dumpit_func, rtnl_calcit_func ); 리눅스 커널네트워킹 (라미로젠 저/강광훈 역,위키북스) p.23 ~ 24 Register message callback 추가/삭제/수정 정보검색 버퍼 사이즈 계산
  • 23. RTNETLINK Message Types https://man7.org/linux/man-pages/man7/rtnetlink.7.html LINK : network interface ADDR : IP address ROUTE : routing information NEIGH : neighbor table (or arp table) RULE : routing rule QDISC : queueing discipline TCLASS : traffic class TFILTER : traffic filter CRD (create/read/delete) 제공
  • 24. RTNETLINK Message Types ● RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK ● RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR ● RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE ● RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH ● RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE ● RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC ● RTM_NEWTCLASS, RTM_DELTCLASS, RTM_GETTCLASS ● RTM_NEWTFILTER, RTM_DELTFILTER, RTM_GETTFILTER https://man7.org/linux/man-pages/man7/rtnetlink.7.html
  • 25. RTNETLINK Message Types ● RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK ● RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR ● RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE ● RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH ● RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE ● RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC ● RTM_NEWTCLASS, RTM_DELTCLASS, RTM_GETTCLASS ● RTM_NEWTFILTER, RTM_DELTFILTER, RTM_GETTFILTER https://man7.org/linux/man-pages/man7/rtnetlink.7.html
  • 26. RTM_*NEIGH CRD for neighbor table ( or arp table) https://man7.org/linux/man-pages/man7/rtnetlink.7.html struct ndmsg { unsigned char ndm_family; int ndm_ifindex; /* Interface index */ __u16 ndm_state; /* State */ __u8 ndm_flags; /* Flags */ __u8 ndm_type; }; struct nda_cacheinfo { __u32 ndm_confirmed; __u32 ndm_used; __u32 ndm_updated; __u32 ndm_refcnt; }; ndmsg (neighbor discovery message) 구조체
  • 27. ndm_state https://man7.org/linux/man-pages/man7/rtnetlink.7.html ndmsg (neighbor discovery message) NUD_INCOMPLETE a currently resolving cache entry NUD_REACHABLE a confirmed working cache entry NUD_STALE an expired cache entry NUD_DELAY an entry waiting for a timer NUD_PROBE a cache entry that is currently reprobed NUD_FAILED an invalid cache entry NUD_NOARP a device with no destination cache NUD_PERMANENT a static entry
  • 28. rta_type https://man7.org/linux/man-pages/man7/rtnetlink.7.html NDA_UNSPEC unknown type NDA_DST a neighbor cache n/w layer destination address NDA_LLADDR a neighbor cache link layer destination address NDA_CACHEINFO cache statistics
  • 29. Pyroute2 https://pypi.org/project/pyroute2/ Pyroute2 is a pure Python netlink library. … The library was started as an RTNL protocol implementation, so the name is pyroute2, but now it supports many netlink protocols
  • 30. (실습3) Dynamic Overlay Network 실습준비 # cd /vagrant # tar -xf overlaynet.tar # tree /vagrant/overlaynet netlink event를 catch하여 arp daemon. arp/fdb 정보 갱신 container를 생성하고 br0 (bridge)에 연결, mac/ip 주소 등록 app_solicit 활성여부 체크 (사용안함) * vxlan l2miss/l3miss 활성 overns 및 bridge/vxlan 구성 container 생성, bridge 연결, mac/ip 주소 등록 (NFS) 초기화. 모든 netns 및 storage/{arp,fdb} 삭제 준비물 : overlaynet.tar NFS. 클러스터 내 모든 컨테이너의 arp/fdb 공유 저장소 지금부터 실습 경로는 /vagrant/overlaynet 입니다. 실습 스크립트 링크 참고
  • 31. (실습3) Dynamic Overlay Network NFS eth1 eth1 192.168.104.2 192.168.104.3 기존 네임스페이스 정리 # cd /vagrant/overlaynet # ./reset.sh # ip netns 터미널 #1 (192.168.104.2) + 터미널 #2 (192.168.104.3)
  • 32. overns (실습3) Dynamic Overlay Network vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 overns 생성 # ./create_overlay.sh 터미널 #1 (192.168.104.2) + 터미널 #2 (192.168.104.3) NFS
  • 33. 11.11.11.3 02:42:c0:a8:00:03 overns (실습3) Dynamic Overlay Network vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 컨테이너 생성 터미널 #1 (192.168.104.2) 터미널 #2 (192.168.104.3) 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 vethO3 redns greenns NFS # ./attach_ctn.sh redns 2 # ./attach_ctn.sh greenns 3 네임스페이스 주소 postfix
  • 34. overns (실습3) Dynamic Overlay Network vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 컨테이너 생성 # ./attach_ctn.sh redns 2 # tree 터미널 #1 (192.168.104.2) # ./attach_ctn.sh greenns 3 # tree 터미널 #2 (192.168.104.3) 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 11.11.11.3 02:42:c0:a8:00:03 vethO3 attach_ctn.sh attach_ctn.sh create write write create redns greenns NFS tree
  • 35. overns (실습3) Dynamic Overlay Network vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 컨테이너 생성 # ip netns exec redns ping -c 1 11.11.11.1 터미널 #1 (192.168.104.2) # ip netns exec greenns ping -c 1 11.11.11.1 터미널 #2 (192.168.104.3) 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 11.11.11.3 02:42:c0:a8:00:03 vethO3 redns greenns NFS ping ping
  • 36. overns (실습3) Dynamic Overlay Network vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 Check L2L3miss # ip netns exec redns ping 11.11.11.3 터미널 #1 (192.168.104.2) # ./l2l3miss.py 터미널 #2 (192.168.104.3) 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns # ./l2l3miss.py 터미널 #3 (192.168.104.2) Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH
  • 37. (실습3) Dynamic Overlay Network L3miss # ip netns exec redns ping -c 1 11.11.11.3 터미널 #1 (192.168.104.2) # ./l2l3miss.py 터미널 #2 (192.168.104.3) # ./l2l3miss.py DEBUG:root:Received an event: RTM_GETNEIGH DEBUG:root:------------ ndmsg start ------------ DEBUG:root:Family: AF_INET DEBUG:root:Interface vxlan1 index: 3 DEBUG:root:State: NUD_STALE DEBUG:root:Flags: 0 DEBUG:root:Type: RTN_UNICAST DEBUG:root:------------ ndmsg end -------------- INFO:root:L3Miss on vxlan1: Who has IP: 11.11.11.3? Check arp table on overns 터미널 #3 (192.168.104.2) L2L3 arp 등록하세요
  • 38. (실습3) Dynamic Overlay Network L3miss # tree storage/arp # cat storage/arp/11.11.11.3 02:42:c0:a8:00:03 터미널 #3 (192.168.104.2) tree storage/arp INFO:root:L3Miss on vxlan1: Who has IP: 11.11.11.3? Check arp table on overns NFS
  • 39. (실습3) Dynamic Overlay Network L3miss → arp table 등록 # ip netns exec overns ip neigh add 11.11.11.3 lladdr 02:42:c0:a8:00:03 dev vxlan1 터미널 #1 (192.168.104.2) overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns ARP Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH ✍ 02:42:c0:a8:00:03
  • 40. (실습3) Dynamic Overlay Network L3miss OK → L2miss 발생 # ip netns exec redns ping -c 1 11.11.11.3 터미널 #1 (192.168.104.2) # ./l2l3miss.py DEBUG:root:Received an event: RTM_GETNEIGH DEBUG:root:------------ ndmsg start ------------ DEBUG:root:Family: AF_INET DEBUG:root:Interface vxlan1 index: 3 DEBUG:root:State: NUD_STALE DEBUG:root:Flags: 0 DEBUG:root:Type: RTN_UNICAST DEBUG:root:------------ ndmsg end -------------- INFO:root:L2Miss on vxlan1: Who has MAC: 02:42:c0:a8:00:03? Check bridge fdb on overns 터미널 #3 (192.168.104.2) L2L3 fdb 등록하세요
  • 41. (실습3) Dynamic Overlay Network L3miss # tree storage/arp # cat storage/arp/02:42:c0:a8:00:03 192.168.104.3 터미널 #3 (192.168.104.2) tree storage/fdb NFS INFO:root:L2Miss on vxlan1: Who has MAC: 02:42:c0:a8:00:03? Check bridge fdb on overns
  • 42. (실습3) Dynamic Overlay Network L2miss → bridge fdb 등록 # ip netns exec overns bridge fdb replace 02:42:c0:a8:00:03 dev vxlan1 self dst 192.168.104.3 vni 42 port 4789 터미널 #1 (192.168.104.2) overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 redns FDB ARP Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH ✍ 192.168.104.3 NFS
  • 43. (실습3) Dynamic Overlay Network L2miss OK → 수신측 L2miss overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns FDB ARP # ip netns exec redns ping 11.11.11.3 터미널 #1 (192.168.104.2) # ./l2l3miss.py . . . INFO:root:L3Miss on vxlan1: Who has IP: 11.11.11.2? Check arp table on overns 터미널 #2 (192.168.104.3) # ./l2l3miss.py 터미널 #3 (192.168.104.2) Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH greenns
  • 44. (실습3) Dynamic Overlay Network 수신측 L2miss ~ arp 등록 overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns FDB ARP # ip netns exec redns ping -c 1 11.11.11.3 터미널 #1 (192.168.104.2) # ip netns exec overns ip neigh add 11.11.11.2 lladdr 02:42:c0:a8:00:02 dev vxlan1 터미널 #2 (192.168.104.3) # ./l2l3miss.py 터미널 #3 (192.168.104.2) ARP Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH ✍ 02:42:c0:a8:00:02
  • 45. (실습3) Dynamic Overlay Network 수신측 L2miss ~ OK overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns FDB ARP # ip netns exec redns ping -c 1 11.11.11.3 터미널 #1 (192.168.104.2) # ip netns exec overns bridge fdb replace 02:42:c0:a8:00:02 dev vxlan1 self dst 192.168.104.2 vni 42 port 4789 터미널 #2 (192.168.104.3) # ./l2l3miss.py 터미널 #3 (192.168.104.2) FDB ARP Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH ✍ 192.168.104.2
  • 46. (실습3) Dynamic Overlay Network red ← ping → green OK overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns FDB ARP # ip netns exec redns ping -c 1 11.11.11.3 터미널 #1 (192.168.104.2) # ip netns exec overns bridge fdb replace 02:42:c0:a8:00:02 dev vxlan1 self dst 192.168.104.2 vni 42 port 4789 터미널 #2 (192.168.104.3) # ./l2l3miss.py 터미널 #3 (192.168.104.2) FDB ARP Netlink L2/L3 miss Netlink L2/L3 miss L2L3 GETNEIGH L2L3 GETNEIGH
  • 47. (실습3) Dynamic Overlay Network arpd를 이용하여 동적으로 arp,fdb를 등록해봅시다 overns vxlan1 br0 eth1 overns vxlan1 br0 eth1 192.168.104.2 192.168.104.3 11.11.11.2 02:42:c0:a8:00:02 eth0 vethO2 eth0 greenns 11.11.11.3 02:42:c0:a8:00:03 vethO3 NFS redns FDB ARP # 터미널 #1 (192.168.104.2) # 터미널 #2 (192.168.104.3) # ./arpd.py 터미널 #3 (192.168.104.2) FDB ARP L2/L3 miss Netlink L2/L3 miss # ./arpd.py 터미널 #4 (192.168.104.3) arpd GETNEIGH Netlink arpd GETNEIGH
  • 48. arpd arpd Netlink overns Lookup 11.11.11.3 02:42:c0:a8:00:03 overns 11.11.11.5 02:42:c0:a8:00:04 (실습3) Dynamic Overlay Network eth0 vxlan1 br0 eth0 GETNEIGH FDB ARP NFS Netlink L2/L3 miss vethO3 eth1 GETNEIGH 11.11.11.4 02:42:c0:a8:00:04 11.11.11.2 02:42:c0:a8:00:02 eth0 eth0 vxlan1 br0 vethO2 vethO4 FDB ARP L2/L3 miss eth1 Lookup vethO5 192.168.104.2 192.168.104.3 bluens redns orangens greenns arpd를 이용하여 동적으로 arp,fdb를 등록해봅시다 # ./attach_ctn.sh bluens 4 터미널 #1 (192.168.104.2) # ./attach_ctn.sh orangens 5 터미널 #2 (192.168.104.3) # ./arpd.py 터미널 #3 (192.168.104.2) # ./arpd.py 터미널 #4 (192.168.104.3) attach_ctn.sh attach_ctn.sh
  • 49. (실습3) Dynamic Overlay Network # ip netns exec bluens ping -c 3 11.11.11.5 # ip netns exec bluens ping -c 3 11.11.11.3 터미널 #1 (192.168.104.2) # ip netns exec orangens ping -c 3 11.11.11.4 # ip netns exec orangens ping -c 3 11.11.11.2 터미널 #2 (192.168.104.3) Good Luck ~ :-) arpd arpd Netlink overns Lookup 11.11.11.3 02:42:c0:a8:00:03 overns 11.11.11.5 02:42:c0:a8:00:04 eth0 vxlan1 br0 eth0 GETNEIGH NFS Netlink L2/L3 miss vethO3 eth1 GETNEIGH 11.11.11.4 02:42:c0:a8:00:04 11.11.11.2 02:42:c0:a8:00:02 eth0 eth0 vxlan1 br0 vethO2 vethO4 L2/L3 miss eth1 Lookup vethO5 192.168.104.2 192.168.104.3 bluens redns orangens greenns FDB ARP ARP FDB
  • 50. (Homework) 노드 (192.168.104.4)를 추가하고 해당 노드에 pinkns, skyns 를 생성하여 다른 노드의 컨테이너와 통신해보세요
  • 51. eth0 Host routes iptables lo eth0 Container 11.11.11.2 routes iptables lo arp table bridge fdb arp table bridge fdb eth0 Container 11.11.11.3 routes iptables lo arp table bridge fdb 이제 여러분은 분산 환경에서 가상 네트워크를 구축하실 수 있습니다. 오늘 배운 vxlan을 이용한 오버레이 네트워크 구축 방식은 쿠버네티스 네트워크 플러그인 중 하나인 Flannel 에서 사용하는 방법입니다. bridge vxlan