Jumbo Frame(巨幀)
創(chuàng)新互聯(lián)專注于新羅網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供新羅營(yíng)銷型網(wǎng)站建設(shè),新羅網(wǎng)站制作、新羅網(wǎng)頁設(shè)計(jì)、新羅網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務(wù),打造新羅網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供新羅網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。
IEEE 802.3以太網(wǎng)標(biāo)準(zhǔn)僅規(guī)定支持1500Byte的幀MTU,總計(jì)1518Byte的幀大小。(使用IEEE 802.1Q VLAN/QoS標(biāo)簽時(shí),增加至1522Byte)而巨型幀往往采用9000Byte的幀MTU,合計(jì)9018/9022Byte的幀大小。
目前巨型幀尚未成為官方的IEEE 802.3以太網(wǎng)標(biāo)準(zhǔn)的一部分。所以不同硬件廠商的設(shè)備支持程度可能不盡相同。
使用巨型幀,增大的有效報(bào)文長(zhǎng)度提升了帶寬使用效率的提升(如下圖)。與此同時(shí),增長(zhǎng)的報(bào)文也帶來傳輸時(shí)延的增加,時(shí)延敏感型數(shù)據(jù)并不適合使用巨型幀傳輸。
neutron中的MTU配置項(xiàng)
從配置項(xiàng)的描述總結(jié)而言,global_physnet_mtu與physical_network_mtus共同定義了underlay physical network的MTU,path_mtu定義了overlay network的MTU。
**調(diào)整MTU的3個(gè)用例
單MTU值物理網(wǎng)絡(luò)體系**
在neutron.conf中
1.[DEFAULT]
2.global_physnet_mtu?=?900
在ml2.ini中
1.[ml2]??
2.path_mtu?=?9000
該配置定義了所有underlay網(wǎng)絡(luò)(flat,vlan)與overlay網(wǎng)絡(luò)(vxlan,gre)的MTU值均為9000。
多MTU值物理網(wǎng)絡(luò)體系
在neutron.conf中
1.[DEFAULT]??
2.global_physnet_mtu?=?9000?
在ml2.ini中
1.? [ovs]??
2.??bridge_mappings?=?provider1:eth2,provider2:eth3,provider3:eth4??
3.? [ml2]??
4.??physical_network_mtus?=?provider2:4000,provider3:1500??
5.??path_mtu?=?9000??
該配置定義了underlay網(wǎng)絡(luò)provider2的MTU值為4000,provider3的MTU值為1500,其他如provider1的MTU值為9000。而overlay網(wǎng)絡(luò)的MTU值為9000。
Overlay網(wǎng)絡(luò)MTU
在neutron.conf中
2.?global_physnet_mtu?=?9000?
在ml2.ini中
2.?path_mtu?=?4000?
該配置定義了所有underlay網(wǎng)絡(luò)MTU值為9000,overlay網(wǎng)絡(luò)的MTU值均為4000。
代碼淺析
創(chuàng)建network resource時(shí)的MTU處理
flat和vlan網(wǎng)絡(luò),根據(jù)實(shí)際的物理網(wǎng)絡(luò)映射與physical_network_mtus、global_physnet_mtu信息,獲取最小可用MTU值。
1.??def?get_deployment_physnet_mtu():??
2.??return?cfg.CONF.global_physnet_mtu??
3.? ??
4.??class?BaseTypeDriver(api.ML2TypeDriver):??
5.??def?init(self):??
6.??try:??
7.? self.physnet_mtus = helpers.parse_mappings(??
8.? cfg.CONF.ml2.physical_network_mtus, unique_values=False??
9.? ? )??
10.??except?Exception as e:??
11.? LOG.error("Failed to parse physical_network_mtus: %s", e)??
12.? self.physnet_mtus = []??
13.? ?
14.??def?get_mtu(self, physical_network=None):??
15.???return?p_utils.get_deployment_physnet_mtu()??
16.? ?
17.?class?FlatTypeDriver(helpers.BaseTypeDriver):??
18.? ? ?...??
19.??def?get_mtu(self, physical_network):??
20.? seg_mtu = super(FlatTypeDriver, self).get_mtu()??
21.??mtu?= []??
22.? if seg_mtu > 0:??
23.? ?mtu.append(seg_mtu)??
24.???if?physical_network in self.physnet_mtus:??
25.? mtu.append(int(self.physnet_mtus[physical_network]))??
26.??return?min(mtu) if mtu else 0??
27.? ?
28.?class?VlanTypeDriver(helpers.SegmentTypeDriver):??
29.? ? ?...??
30.??def?get_mtu(self, physical_network):??
31.? seg_mtu = super(VlanTypeDriver, self).get_mtu()??
32.? mtu = []??
33.??if?seg_mtu > 0:??
34.? mtu.append(seg_mtu)??
35.??if?physical_network in self.physnet_mtus:??
36.? mtu.append(int(self.physnet_mtus[physical_network]))??
37.??return?min(mtu) if mtu else 0??
Geneve,Gre,Vxlan類型網(wǎng)絡(luò),則根據(jù)global_physnet_mtu與path_mtu中選取最小的可用MTU值,減去各類型報(bào)文頭部開銷,獲取實(shí)際可用MTU值。
1.? class _TunnelTypeDriverBase(helpers.SegmentTypeDriver):??
2.? ...??
3.? def get_mtu(self, physical_network=None):??
4.? seg_mtu = super(_TunnelTypeDriverBase, self).get_mtu()??
5.? mtu = []??
6.? if seg_mtu > 0:??
7.? mtu.append(seg_mtu)??
8.? if cfg.CONF.ml2.path_mtu > 0:??
9.? mtu.append(cfg.CONF.ml2.path_mtu)??
10.? version = cfg.CONF.ml2.overlay_ip_version??
11.? ip_header_length = p_const.IP_HEADER_LENGTH[version]??
13.? ?
15.? ...??
def get_mtu(self, physical_network=None):??
mtu = super(GeneveTypeDriver, self).get_mtu()??
19.? ?
21.? ? ?...??
23.? mtu = super(GreTypeDriver, self).get_mtu(physical_network)??
24.? return mtu - p_const.GRE_ENCAP_OVERHEAD if mtu else 0??
25.? ? ? ? ? ?
27.? ...??
def get_mtu(self, physical_network=None):??
mtu = super(VxlanTypeDriver, self).get_mtu()??
在用戶實(shí)際創(chuàng)建network資源時(shí),若未顯式指定網(wǎng)絡(luò)MTU值,則使用該網(wǎng)絡(luò)類型下系統(tǒng)定義的最大可用MTU。若顯式指定MTU,neutron會(huì)檢查用戶定義MTU是否小于等于該網(wǎng)絡(luò)類型下系統(tǒng)定義的最大可用MTU。
1.? def _get_network_mtu(self, network_db, validate=True):??
2.? mtus = []??
3.? ...??
4.? for s in segments:??
5.? segment_type = s.get('network_type')??
6.? if segment_type is None:??
7.? ?...??
8.? else:??
9.? mtu = type_driver.get_mtu(s['physical_network'])??
11.? # then is that for the segment type, MTU has no meaning or??
13.? if mtu:??
14.? mtus.append(mtu)??
15.? ?
max_mtu = min(mtus) if mtus else p_utils.get_deployment_physnet_mtu()??
18.? ?
19.? if validate:??
20.? # validate that requested mtu conforms to allocated segments??
21.? if net_mtu and max_mtu and max_mtu < net_mtu:??
msg = _("Requested MTU is too big, maximum is %d") % max_mtu??
24.? ?
25.? # if mtu is not set in database, use the maximum possible??
虛擬機(jī)tap設(shè)置MTU
在使用Linux Bridge實(shí)現(xiàn)的Neutron網(wǎng)絡(luò)中,Linux Bridge Agent在偵測(cè)到新的device后,會(huì)通過ip link set 操作,根據(jù)network中的MTU值,設(shè)置虛擬機(jī)綁定至Linux Bridge的tap設(shè)備的MTU值。反觀Openvswitch實(shí)現(xiàn)的網(wǎng)絡(luò)中卻沒有相關(guān)的設(shè)置。實(shí)際在使用過程中需要通過ovs-vsctl set Interface <tap name> mtu_request=<MTU Value>命令人工去設(shè)置tap設(shè)備的MTU值。
1.? class LinuxBridgeManager(amb.CommonAgentManagerBase):??
2.? def plug_interface(self, network_id, network_segment, tap_name,??
3.? device_owner):??
4.? return self.add_tap_interface(network_id, network_segment.network_type,??
5.? network_segment.physical_network,??
6.? network_segment.segmentation_id,??
7.? tap_name, device_owner,??
8.? network_segment.mtu)??
9.? ??
10.? def _set_tap_mtu(self, tap_device_name, mtu):??
網(wǎng)絡(luò)設(shè)備tap設(shè)置MTU
dhcp和router相關(guān)的tap設(shè)備在plug時(shí),neutron會(huì)根據(jù)網(wǎng)絡(luò)的MTU,在各tap設(shè)備所在的namespace內(nèi)運(yùn)行“ip link set <tap name> mtu <MTU value>”設(shè)置tap設(shè)備的MTU值。
1.? class OVSInterfaceDriver(LinuxInterfaceDriver):??
3.? bridge=None, namespace=None, prefix=None, mtu=None):??
4.? ...??
5.? # NOTE(ihrachys): the order here is significant: we must set MTU after??
6.? # the device is moved into a namespace, otherwise OVS bridge does not??
7.? # allow to set MTU that is higher than the least of all device MTUs on??
8.? # the bridge??
9.? if mtu:??
10.? self.set_mtu(device_name, mtu, namespace=namespace, prefix=prefix)??
11.? else:??
12.? LOG.warning("No MTU configured for port %s", port_id)??
13.? ...??
14.? ?
16.? if self.conf.ovs_use_veth:??
tap_name = self._get_tap_name(device_name, prefix)??
19.? tap_name, device_name, namespace2=namespace)??
20.? root_dev.link.set_mtu(mtu)??
else:??
23.? ns_dev.link.set_mtu(mtu)??
24.? ?
class IpLinkCommand(IpDeviceCommandBase):??
27.? ? ?...??
28.? def set_mtu(self, mtu_size):??
29.? self._as_root([], ('set', self.name, 'mtu', mtu_size))?
bridge間veth設(shè)置MTU
Openstack從J版以后,neutron使用ovs patch port代替了linux veth實(shí)現(xiàn)OVS網(wǎng)橋之間的連接(出于性能提升的目的)。但依舊保留了veth連接的方式。在openvswitch_agent.ini中可以通過配置use_veth_interconnection=true啟用veth連接網(wǎng)橋的功能。如果開啟這項(xiàng)配置,默認(rèn)的veth_mtu值為9000。當(dāng)配置鏈路MTU大于9000時(shí),需要修改openvswitch_agent.ini配置文件中veth_mtu的值,以免發(fā)生瓶頸效應(yīng)。
1.? class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,??
2.? dvr_rpc.DVRAgentRpcCallbackMixin):??
3.? def init(self, bridge_classes, ext_manager, conf=None):??
4.? ...??
5.? self.use_veth_interconnection = ovs_conf.use_veth_interconnection??
6.? self.veth_mtu = agent_conf.veth_mtu??
7.? ?...??
8.? def setup_physical_bridges(self, bridge_mappings):??
9.? ?'''''Setup the physical network bridges.?
10.??
11.? Creates physical network bridges and links them to the?
12.? integration bridge using veths or patch ports.?
13.??
14.? ?:param bridge_mappings: map physical network names to bridge names.?
15.? ?'''??
16.? self.phys_brs = {}??
17.? self.int_ofports = {}??
18.? self.phys_ofports = {}??
19.? ip_wrapper = ip_lib.IPWrapper()??
20.? ovs = ovs_lib.BaseOVS()??
21.? ovs_bridges = ovs.get_bridges()??
22.? for physical_network, bridge in bridge_mappings.items():??
23.? ?...??
24.? ?if self.use_veth_interconnection:??
25.? ?# enable veth to pass traffic??
26.? int_veth.link.set_up()??
27.? ?phys_veth.link.set_up()??
28.? ?if self.veth_mtu:??
29.? ?# set up mtu size for veth interfaces??
30.? int_veth.link.set_mtu(self.veth_mtu)??
31.? phys_veth.link.set_mtu(self.veth_mtu)??
32.? else:??
33.? # associate patch ports to pass traffic??
34.? self.int_br.set_db_attribute('Interface', int_if_name,??
35.? ?'options', {'peer': phys_if_name})??
36.? br.set_db_attribute('Interface', phys_if_name,??
37.? ? 'options', {'peer': int_if_name})??
虛擬機(jī)網(wǎng)卡如何設(shè)置MTU
虛擬機(jī)內(nèi)部網(wǎng)卡配置MTU則是通過虛擬機(jī)DHCP請(qǐng)求IP地址時(shí),順便請(qǐng)求MTU值。在RFC2132 DHCP Option and BOOTP Vendor Extensions里明確定義了Interface MTU Option。DHCP Option Code 26 用兩個(gè)字節(jié)的MTU數(shù)據(jù),定義了網(wǎng)絡(luò)接口的MTU值。如下表所示。
在DHCP agent中,DNSmasq的spawn_process會(huì)根據(jù)network的MTU值調(diào)整自身的啟動(dòng)參數(shù)。從而使虛擬機(jī)在DHCP過程中能正確地配置自身網(wǎng)卡的MTU值。
1.? class Dnsmasq(DhcpLocalProcess):??
2.? def _build_cmdline_callback(self, pid_file):??
3.? # We ignore local resolv.conf if dns servers are specified??
4.? # or if local resolution is explicitly disabled.??
5.? ...??
6.? mtu = getattr(self.network, 'mtu', 0)??
7.? ?# Do not advertise unknown mtu??
8.? ?if mtu > 0:??
9.? cmd.append('--dhcp-option-force=option:mtu,%d' % mtu)??
10.? ?...??
11.? return cmd??
探測(cè)MTU
通過指定ICMP報(bào)文內(nèi)容size以及IP報(bào)文不分片來探測(cè)MTU值設(shè)置是否正確。注意這里的size是指icmp data size。該size并不包含ICMP報(bào)文頭部長(zhǎng)度(8Byte)以及IP頭部長(zhǎng)度(20Byte)。
windows下:
1.? ping -f -l <size> <target_name/target_ip>??
linux下:
分享題目:OpenstackJumboFrame調(diào)整實(shí)踐
當(dāng)前網(wǎng)址:http://www.rwnh.cn/article22/gshdjc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、自適應(yīng)網(wǎng)站、響應(yīng)式網(wǎng)站、外貿(mào)建站、網(wǎng)站建設(shè)、手機(jī)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)