使用CentOS Linux Bridge搭建Vxlan環境

來源:互聯網
上載者:User

標籤:tail   vmw   結構   版本   enable   remote   .net   div   虛擬網卡   

一、 基礎環境
使用VmWare虛擬兩台Linux機器。CentOS 7,Linux核心如下:
4.5.3-1.el7.elrepo.x86_64
如果核心版本太低,是不支援VxLan的。可以使用一下命令進行核心升級

 

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org   

[plain] view plain copy  
  1. rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm  
  2. yum --enablerepo=elrepo-kernel install  kernel-ml-devel kernel-ml -y  


升級後重啟選擇新核心。

二、 組網圖

兩台虛機VM1和VM2,eth2為虛機上的網卡。vxlan10是建立的虛擬網卡,用來處理vxlan。veth1和veth0是建立的一對虛擬口。br-vx是建立的橋接器。
三、 配置命令
VM1:
 

[html] view plain copy  
  1. #建立橋接器br-vx並使其up  
  2. brctl addbr br-vx  
  3. ip link set br-vx up  
  4. #增加一個類型為vxlan,vni-id為100的,名字為vxlan10的虛擬網卡,指明對端地址為192.168.233.190,  
  5. #(此地址為VM2的eth2的地址)出介面為本端的eth2  
  6. ip link add vxlan10 type vxlan id 100 remote 192.168.233.190 dstport 4789 dev eth2  
  7. ip link set vxlan10 up  
  8. #把vxlan10加入到橋接器中  
  9. brctl addif br-vx vxlan10  
  10. #建立一對虛擬網卡,設定其中的veth0的地址為192.167.1.6,並把veth1綁到橋接器br-vx中。從veth0  
  11. #發出的報文將會發給veth1,由於veth1在橋接器中,會被進入到vxlan10中通過vxlan隧道發送給對端  
  12. ip link add type veth  
  13. ifconfig veth0 192.167.1.6/24 up  
  14. ifconfig veth0 mtu 1450  
  15. ifconfig veth1 up  
  16. ifconfig veth1 mtu 1450  
  17. brctl addif br-vx veth1  



VM2:
 

[html] view plain copy  
  1. #建立橋接器br-vx並使其up  
  2. brctl addbr br-vx  
  3. ip link set br-vx up  
  4. #增加一個類型為vxlan,vni-id為100的,名字為vxlan10的虛擬網卡,指明對端地址為192.168.233.180,  
  5. #(此地址為VM2的eth2的地址)出介面為本端的eth2  
  6. ip link add vxlan10 type vxlan id 100  remote 192.168.233.180 dstport 4789 dev eth2  
  7. ip link set vxlan10 up  
  8. #把vxlan10加入到橋接器中  
  9. brctl addif br-vx vxlan10  
  10. #建立一對虛擬網卡,設定其中的veth0的地址為192.167.1.7,並把veth1綁到橋接器br-vx中。從veth0  
  11. #發出的報文將會發給veth1,由於veth1在橋接器中,會被進入到vxlan10中通過vxlan隧道發送給對端  
  12. ip link add type veth  
  13. ifconfig veth0 192.167.1.7/24 up  
  14. ifconfig veth0 mtu 1450  
  15. ifconfig veth1 up  
  16. ifconfig veth1 mtu 1450  
  17. brctl addif br-vx veth1  



四、 驗證
搭建好後,可以在VM1上使用ping命令來驗證:VM1: ping 192.167.1.7,通過tcpdump抓報文看結構。
 

參考文章:http://blog.csdn.net/xingyeping/article/details/51353321

使用CentOS Linux Bridge搭建Vxlan環境

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.