找回密码
 注册
查看: 4275|回复: 1

openstack安全组规则

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2019-3-5 01:55:56 | 显示全部楼层 |阅读模式
参考官方资料3 N. I1 h2 q  U* u8 l& k' q6 g& g" A
You must modify the rules for the default security group because users cannot access instances that use the default group from   
: r! L. @' D4 H3 g# \9 r3 Tany IP address outside the cloud.  
1 d3 Y3 s# X. X4 ~3 J# f" B5 F2 Y* D& m. z
You can modify the rules in a security group to allow access to instances through different ports and protocols. For example,   
% \3 z$ F* @" O2 o7 nyou can modify rules to allow access to instances through SSH, to ping them, or to allow UDP traffic – for example, for a DNS   $ D# n1 x$ l0 k* l
server running on an instance. You specify the following parameters for rules:  
: f5 ~" o. E6 u8 ~  E# D% q7 S5 l8 [' O% C  e& K# ?! N! f* a
Source of traffic. Enable traffic to instances from either IP addresses inside the cloud from other group members or from all IP addresses.  / P% T2 o& v3 N, }) E/ R' b

# v. Y! p) Z  A/ g. O! C* vProtocol. Choose TCP for SSH, ICMP for pings, or UDP.  
; n6 f. F1 a  w( D! b6 z# e& i& c. n! _; h
Destination port on virtual machine. Defines a port range. To open a single port only, enter the same value twice. ICMP does not support ports: Enter values to define the codes and types of ICMP traffic to be allowed.  7 K* i( o- O. n2 p& z& E

$ v* }3 ]" z' N- }# n0 NRules are automatically enforced as soon as you create or modify them.  9 m8 ^+ Z0 I! Q6 w

' c8 z6 x& ~) }* K注: 已通过测试, 修改默认 secgroup 或自定义 secgroup 都可以完成数据访问测试
& L$ M2 _5 O' \* S帮助
8 C. _4 h7 n1 [9 R[root@station140 ~(keystone_admin)]# nova help | grep secgroup  7 Q4 M% O6 E* o& j! A( D( \  Z, E
    add-secgroup        Add a Security Group to a server.  
& }) r/ Q* Q9 V" d6 ^) Z    list-secgroup       List Security Group(s) of a server.  
: Y2 d3 W0 X7 [2 ]& b) u    remove-secgroup     Remove a Security Group from a server.  6 l/ h3 |: I  A, h' o& M
    secgroup-add-group-rule  
( j( y2 C0 n3 Z    secgroup-add-rule   Add a rule to a security group.  
6 E, D) ~5 Y7 K% y8 _    secgroup-create     Create a security group.    G3 N+ p5 }) M+ E
    secgroup-delete     Delete a security group.  9 L" r' q: g7 I* R9 }
    secgroup-delete-group-rule  5 r3 C! Y9 T1 z- q( H
    secgroup-delete-rule  
7 Z( a6 \- t7 i8 m$ ?    secgroup-list       List security groups for the current tenant.  
- N: r. p, R. l    secgroup-list-rules  ! L9 ^) G  ]4 T, g: D- t
    secgroup-update     Update a security group.  
/ G/ u& ]9 \2 T: w9 ?  U; ]- C9 `复制代码8 t6 U  o% {' D
1 U  N. D2 w8 \- G  y
* d6 D1 l- T4 i. G+ {! i3 s
创建自定义安全组
1 {' [: Y9 U; G; a1 L' c[root@station140 ~(keystone_admin)]# nova secgroup-create terry "allow ping and ssh"  " Q2 B7 @- J4 I+ H4 `4 ]
+--------------------------------------+-------+--------------------+  
2 I8 |  k; S+ [) {8 a: O| Id                                   | Name  | Description        |  % L6 P, z, @5 c1 C3 ?1 J
+--------------------------------------+-------+--------------------+  ' ?  `& j$ q# A+ }7 g) u
| 6966a8e4-0980-40ad-a409-baac65b60287 | terry | allow ping and ssh |  
3 O+ Q( f% Z, {8 i* w# D5 {+--------------------------------------+-------+--------------------+  7 B: U) N  p  z7 W
复制代码  w( q5 }; Z( }
% V. \1 \4 D9 x3 M% N0 p5 R

' z5 t# d$ `9 j: ~0 o列出当前所有安全组$ a! e' f1 `, F1 `9 E7 z, t
[root@station140 ~(keystone_admin)]# nova  secgroup-list  8 Y7 ?9 A$ N  q1 q8 q
+--------------------------------------+---------+--------------------+  ' H, k5 ^8 s! c$ D- S
| Id                                   | Name    | Description        |  
& t- Z1 r) _1 T; `5 V' S+--------------------------------------+---------+--------------------+  
0 X& b$ n7 U$ c! Q% T9 ?* c2 Q( J| 91a191a6-b89e-4f87-99c0-0fb985985978 | default | default            |  / W% v8 d7 f1 D$ q
| 6966a8e4-0980-40ad-a409-baac65b60287 | terry   | allow ping and ssh |  
' a- c0 T7 W- n, E$ T& i+--------------------------------------+---------+--------------------+  
: _5 {% E1 s: k# ^: ?# V复制代码  U5 i) w$ Y5 n; y
& j/ p: B, D, e% c9 G3 |
( a0 V+ S/ z# w/ @3 R
列出某个组中的安全规则
' ^) D9 c- x% l9 t. s. Y( f5 O! e[root@station140 ~(keystone_admin)]# nova  secgroup-list-rules default  
8 G/ h5 I3 \, @$ @+-------------+-----------+---------+----------+--------------+    ~* C5 \, j# T6 p
| IP Protocol | From Port | To Port | IP Range | Source Group |  ( r3 L0 o- O' U/ W) ^
+-------------+-----------+---------+----------+--------------+  6 l( z6 V! G8 L, g0 c' ~
|             |           |         |          | default      |  / Z* ~" f# c1 X/ b# M# j! ?2 _
|             |           |         |          | default      |  . H! y1 q4 D: F8 ^* D3 J
+-------------+-----------+---------+----------+--------------+  $ V- _3 T2 j1 G' c( q/ {# H0 K
复制代码
# Q4 ]. L& I; e4 `, m: N
9 u$ g. G1 F: u4 g- s2 Y, p
. W9 s+ z2 d- G1 u" f: p增加规则方法 (允许 ping)8 F* }. V  @; k- i5 ~
[root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry icmp -1 -1 0.0.0.0/0  
' j$ D- G: A! h* c* d+-------------+-----------+---------+-----------+--------------+  
3 h+ J; Z& f* ?| IP Protocol | From Port | To Port | IP Range  | Source Group |  
" }, P: f( t0 X9 Z$ S+-------------+-----------+---------+-----------+--------------+  / w! W4 \3 [1 D
| icmp        | -1        | -1      | 0.0.0.0/0 |              |  - T/ f. U, `3 |) l  w4 e
+-------------+-----------+---------+-----------+--------------+  
* M9 t5 z+ D' v$ N复制代码% |5 ]; F' k- l1 O% D3 h

  S. e! @+ T5 N+ H( Z
  w* u: `4 y; |/ f9 H# d3 \4 l增加规则方法 (允许 ssh)7 V7 J; k2 i6 i6 Q3 z6 U, b0 X0 f- {
[root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry tcp  22 22 0.0.0.0/0  
) R/ f; M& G7 H6 \; e+-------------+-----------+---------+-----------+--------------+  * h6 o1 C7 k+ L+ B* \- o; R
| IP Protocol | From Port | To Port | IP Range  | Source Group |  
% J" H8 f, Q5 q6 d+-------------+-----------+---------+-----------+--------------+  
. g4 t0 m7 }, F; f  F0 [3 D| tcp         | 22        | 22      | 0.0.0.0/0 |              |  
0 \7 m# C. m  g+ y3 m# S+-------------+-----------+---------+-----------+--------------+  
1 a# |4 G8 U& ~) K! F/ R  k6 C复制代码
' K7 l4 I# K; ~5 N5 g6 x( d! [' j! {# e* R5 g4 z& o

( b: A8 U; b- I' Q+ ^$ I增加规则方法 (允许 dns 外部访问)( E* }  T5 }% g3 r# z) L' K
[root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry udp 53 53 0.0.0.0/0  
/ m3 K, V# o/ n. n* P. Y+-------------+-----------+---------+-----------+--------------+  
% O* `9 f* C- _% V3 q8 p3 e+ G| IP Protocol | From Port | To Port | IP Range  | Source Group |  5 ]0 ]+ P+ \$ q# a0 Q
+-------------+-----------+---------+-----------+--------------+  ) e  k% m( R5 ]
| udp         | 53        | 53      | 0.0.0.0/0 |              |  - e% G( b& D6 I% H( p  J
+-------------+-----------+---------+-----------+--------------+: @, F; B$ G) r" L# [( r
复制代码# H, V9 N+ N' Z$ d: K) Y. s0 t
' `3 Z5 R6 z5 h- [& T9 C- J
$ w* [. |/ Y5 Z0 I" i# H9 J% }
列出自定义组规则
* S: k9 `: b& j! P' P4 W; R! U: h[root@station140 ~(keystone_admin)]# nova secgroup-list-rules terry  8 a7 m2 N0 i" V" Q% k6 i7 v1 g
+-------------+-----------+---------+-----------+--------------+  
+ G' F9 _% p, q" }& L( T  y/ O| IP Protocol | From Port | To Port | IP Range  | Source Group |  
% c/ d9 X, |( \8 _2 `! |* t+-------------+-----------+---------+-----------+--------------+  
( ^% X$ f  R' {0 C2 ^' e; p3 H| tcp         | 22        | 22      | 0.0.0.0/0 |              |  
4 t7 {& e6 Z. z* @/ O| udp         | 53        | 53      | 0.0.0.0/0 |              |  
6 I( C: Y1 {5 }* [7 q| icmp        | -1        | -1      | 0.0.0.0/0 |              |  0 A2 m# w+ Y  M- N' @5 C
+-------------+-----------+---------+-----------+--------------+
" z( Q% W9 f, V  `复制代码
) h% M: l/ F) A# u: ?) j; n
" n) g3 X4 r6 g0 V* p0 Z6 m' z7 _- \: L( y2 q
尝试修改 default secgroup
9 h  [, r( Z* T1 `& H' ~9 }; F列出 default secgroup 规则" U+ ?  f, }' P) @% T. q1 _( P
[root@station140 ~(keystone_admin)]# nova secgroup-list-rules default  
/ z3 D/ R: y, d5 `' _+-------------+-----------+---------+----------+--------------+  # S, |* B% ~# i, N5 l. r# c8 F& h
| IP Protocol | From Port | To Port | IP Range | Source Group |  
# z8 \1 V4 ]+ b# `+ {+-------------+-----------+---------+----------+--------------+  ! F! b3 T5 C  ^# f# S: `" r0 e  U: T
|             |           |         |          | default      |  ) x* x% u; ?! Q: a$ }$ b
|             |           |         |          | default      |  $ D8 R* W1 K# W3 ]: K3 p
+-------------+-----------+---------+----------+--------------+
2 S0 O( J# ?* m% |复制代码
; {  N% u0 p! o# A/ r
7 s" W+ T# [9 A2 U" r" u
# L" ^6 {, ^+ @8 `) y) s& s添加规则 (允许 ping)
0 I6 k/ T  R8 I/ n, @. o[root@station140 ~(keystone_admin)]# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0  
" G. `  W* o, ?" J# \1 o+-------------+-----------+---------+-----------+--------------+  0 S/ ^3 r& t& ]% Q
| IP Protocol | From Port | To Port | IP Range  | Source Group |  
) {9 x3 S3 l% a9 X' X% j1 G+-------------+-----------+---------+-----------+--------------+  ! U3 `. {. G) E( A% Q& Z* J9 j
| icmp        | -1        | -1      | 0.0.0.0/0 |              |  
+ y) r/ b! V* r6 I, W+-------------+-----------+---------+-----------+--------------+  2 w1 y- V- `) @; `1 M6 T
复制代码- q; X, D& Q3 Q1 \8 D

% ?. H, m5 y! d: u1 [1 j, y
- L% {7 R  i# e" o, p- U- U添加规则 (允许 ssh)$ y7 t3 ~  c$ N
[root@station140 ~(keystone_admin)]# nova secgroup-add-rule default tcp  22 22 0.0.0.0/0  . K0 D/ J' V4 {. k" D& P% t# x
+-------------+-----------+---------+-----------+--------------+  . _7 }& {+ k. \: ~# T
| IP Protocol | From Port | To Port | IP Range  | Source Group |  4 A# ]. m1 _6 V& E# b' \
+-------------+-----------+---------+-----------+--------------+  
( n( b- b$ {. @" j| tcp         | 22        | 22      | 0.0.0.0/0 |              |  1 f/ Z7 |# q+ Q/ B, M  c
+-------------+-----------+---------+-----------+--------------+! K, j0 s( c* @+ Z4 E& l1 D" g9 u" x
复制代码& S' p# Q6 f( l* b. e9 E
; C; X5 J7 c% h/ i# {6 F$ F

) X$ O* U* i8 D3 E/ D6 l添加规则 (允许 dns外部访问)! [2 W4 K: x  V" g9 t9 _
[root@station140 ~(keystone_admin)]# nova secgroup-add-rule default udp 53 53 0.0.0.0/0  1 k' m4 |2 ^% d5 G8 n  M
+-------------+-----------+---------+-----------+--------------+  
8 \8 x+ Z% E# R' T| IP Protocol | From Port | To Port | IP Range  | Source Group |  
5 @$ n# R+ F+ m0 j3 ?3 J; j! w4 t+-------------+-----------+---------+-----------+--------------+    w. G$ E% x- E' T5 N" S  V! @
| udp         | 53        | 53      | 0.0.0.0/0 |              |  / F& c( @. C8 `7 q! F* T
+-------------+-----------+---------+-----------+--------------+  
1 j" P) g2 e. Z/ U0 `' S复制代码8 q- E: [' `" _
: N# C( K# Y5 n; c/ w0 v2 h7 ?

# @( T# f9 h( }列出默认组规则
& N+ l: I" `) a( t  L) I/ D[root@station140 ~(keystone_admin)]# nova secgroup-list-rules default  ' ]" X/ R3 _7 N3 q& g. G
+-------------+-----------+---------+-----------+--------------+  
( _4 X- ~! r8 o  ~) o8 }! ?2 r| IP Protocol | From Port | To Port | IP Range  | Source Group |  
; s5 o2 r9 O6 z# l+-------------+-----------+---------+-----------+--------------+  / a: R# p9 n% A+ f. i; b
|             |           |         |           | default      |  
+ c% E7 d0 f! k# d5 C8 h. f  }| icmp        | -1        | -1      | 0.0.0.0/0 |              |  0 j- ~* o- o( L# _
| tcp         | 22        | 22      | 0.0.0.0/0 |              |  
, _  I# p" ~& U0 N! q|             |           |         |           | default      |  
& s- w) I' V* `2 v$ ^; N9 j| udp         | 53        | 53      | 0.0.0.0/0 |              |  
& M+ Z& [3 x- b" w( F8 E+-------------+-----------+---------+-----------+--------------++ a: S2 z- h2 v5 ^" `' Z
复制代码8 C  {# H) z- [/ J" D4 X
$ I) M7 f- {! |7 s; c4 E" F

* Z9 ]: @- L. B' \( V: g/ X2 C删除某个实例, 使用中的规则
: d  |7 V7 v7 L9 n& P& o: qnova remove-secgroup terry_instance1 terry) y4 V" a  o5 W3 S( ]
复制代码' k6 B; a+ m/ @+ R, A
4 \6 j: A$ G. @- T3 d; p
2 ^; y5 K2 v) P2 s  |$ M
注: 在虚拟机启动后, 无法在增加其他规则/ c: c3 g- Q" V2 D
4 H- a" B0 u' T0 h9 C2 q& U

4 g( n2 s& f+ S' a  l
2 I; l' G3 z6 m) P2 V1 z" gopenstack 命令行管理:内部网络[instance专用]管理 - Q" l* V! z+ i- l6 F/ Z! I
ip 帮助
0 m9 N' [% T! V[root@station140 ~(keystone_admin)]# nova help | grep ip  
4 E! D+ A1 F* \% m    add-fixed-ip        Add new IP address on a network to server.  
7 W' M$ ~. ]0 e2 {8 @0 Z( g    add-floating-ip     Add a floating IP address to a server.  - a. ]) G4 G4 B
    cloudpipe-configure  6 {- x9 T7 p3 P( b5 ^4 d0 ?* }+ X
                        Update the VPN IP/port of a cloudpipe instance.  $ t* {! p4 I3 ~7 {$ ?7 w
    cloudpipe-create    Create a cloudpipe instance for the given project.  
! S1 {9 \4 P; U. n6 Q% q    cloudpipe-list      Print a list of all cloudpipe instances.  , W& u. M3 M% ?* k1 ?
    dns-create          Create a DNS entry for domain, name and ip.  ( m# b3 ~" R$ T$ i/ ~/ ^/ D% n
    dns-list            List current DNS entries for domain and ip or domain  4 o! g+ h: C# S5 Y3 Z+ X/ q
    fixed-ip-get        Retrieve info on a fixed ip.  
0 c+ B9 ]6 v$ |' p" M    fixed-ip-reserve    Reserve a fixed IP.  " ^; P# h) J( {; U
    fixed-ip-unreserve  Unreserve a fixed IP.  ; I: W. V% L  b! N9 `$ L% U: o
    floating-ip-bulk-create  ) Y. K- W5 D3 d  A& l- |
                        Bulk create floating ips by range.  - N" f2 |& a- J; s
    floating-ip-bulk-delete  3 b9 O) c4 K$ X  G3 {. L# r$ T
                        Bulk delete floating ips by range.  + `0 c! M8 q$ ?& p: ?9 ~0 w
    floating-ip-bulk-list  ) y7 I9 F6 Y. N7 x/ c8 _9 T" X4 b
                        List all floating ips.  5 x9 P& z* f8 k- i* n! T2 g% W
    floating-ip-create  Allocate a floating IP for the current tenant.  + j/ B  b" G* n2 J+ K% v' c
    floating-ip-delete  De-allocate a floating IP.  7 K' k( M4 z; H5 z
    floating-ip-list    List floating ips for this tenant.  1 D' G) [- U& e. v& X9 [
    floating-ip-pool-list  
7 o& w; P2 _2 k" S" _2 T) t                        List all floating ip pools.  9 _9 k: X: X# d7 Y4 P3 }( i6 ~+ S
    remove-fixed-ip     Remove an IP address from a server.  ( J: _4 V  O# c
    remove-floating-ip  Remove a floating IP address from a server.  8 r/ ]  [6 p; a5 u
复制代码
' T, K5 n  K+ a
* V: f" J9 S/ ~4 ^# ^* q5 s5 }: m  a$ E; [
网络管理帮助
2 G) D, }  T" g0 W( W[root@station140 ~(keystone_admin)]# nova help | grep network  
% `9 X2 h6 @2 W$ h) [* q    interface-attach    Attach a network interface to an instance.  9 F. p+ P. R2 z  H
    interface-detach    Detach a network interface from an instance.  + I  O6 M& O' e$ ~
    network-associate-host  0 Y" H7 r+ Z" c# M; ]* d; U
                        Associate host with network.  
$ H' K4 c" V; {* M# U    network-associate-project  % H0 {+ I- x, Z; y, j5 L. O
                        Associate project with network.  
0 [9 r/ N7 O3 r. A# S    network-create      Create a network.  
0 l  M3 U# T7 f! J: \( P. u    network-disassociate  7 B0 }3 ]9 B% m- z7 m( l
                        network.  ) o+ ~+ e2 I0 Z7 l( u
    network-list        Print a list of available networks.  7 Y3 a/ |- _3 L) C
    network-show        Show details about the given network.  
- e8 O' I$ K8 R. Q    reset-network       Reset network of an instance.  7 z+ X* H/ g7 r/ P: V" u% r* U
                        Add a network interface to a baremetal node.  
2 p, r' ~4 U1 B# O1 I                        List network interfaces associated with a baremetal  
& `: |0 [& V* Y* ?! P9 r$ G$ u                        Remove a network interface from a baremetal node.  
& m9 w  g6 N/ d# x4 E    net                 Show a network  
" G: c, C  P/ o% t    net-create          Create a network  
8 _6 Y+ m) T) D6 [3 G+ W( g# O6 P* W    net-delete          Delete a network  
6 a3 f2 ~6 N3 x+ h# d    net-list            List networks  
' |- e& O' Y: c7 I) Q5 s# m复制代码
2 ~1 `6 z* t* c2 j0 t" p( q$ q9 |: R! x& P) {! E7 \
. D& x) s! x0 Z; L: N
显示当前 openstack 网络方法
/ {; d4 y/ L% |9 A" o) l[root@station140 ~(keystone_admin)]# nova network-list  ; X2 _6 k% H: M
+--------------------------------------+---------+------+  + C, ~  e4 @5 Z" Z9 W/ L4 d
| ID                                   | Label   | Cidr |  
9 D4 P( L& s5 ^+ X0 j# h7 X1 h+--------------------------------------+---------+------+  
% w" j) i8 o5 ?3 P| 68a1d874-e7bd-42e2-9f86-8eb0b0b4b8fd | public  | None |  
% h4 ?0 l2 F: `3 B| e8e14001-44d9-4ab1-a462-ea621b8a4746 | private | None |  6 O( h3 Q! o: k
+--------------------------------------+---------+------+  
! ^0 F0 e1 q. q3 n2 w复制代码* w" A; ?+ k# o. p& d/ T

8 a3 D; F) [* V3 a" b: O
) b( r9 D5 ]! G  U! U; q参考 openstack 官方文档, 在某些旧版本中, 需要利用下面方法创建网络, 当前 H 版本可以不使用下面变量
8 Z+ \- G2 @+ n6 c( W" i) s8 @export OS_USERNAME=admin  & Y6 }: @; r8 v2 o# {7 O
export OS_PASSWORD=password  # X  L# V/ Z6 R3 |# D" O$ [
export OS_TENANT_NAME=admin  - B- f2 G9 T( m. O! C$ |1 u' n
export OS_AUTH_URL=http://localhost:5000/v2.0
( Q/ e/ H# C( `复制代码
0 `8 O: {5 _# d& l  z4 c3 @+ Q3 P9 w3 {2 R) b! B* y

! K# i* v1 p" u" C9 H" q( ]另外一种列出网络方法) A9 u0 o+ p4 ~0 D
[root@station140 ~(network_admin)]# neutron net-list  
8 y" M& s' H$ I! s+ o+--------------------------------------+---------+------------------------------------------------------+  
1 O8 u1 Z) T  p$ [$ n( j| id                                   | name    | subnets                                              |  ; C6 s* m$ k- }( p' P: \
+--------------------------------------+---------+------------------------------------------------------+  ; t# @9 O! p9 V. y0 D+ d% _, u
| 68a1d874-e7bd-42e2-9f86-8eb0b0b4b8fd | public  | ce0a4a92-5c23-4557-ad67-97560ab5afa1 172.24.4.224/28 |  ) Q* e' Z, }7 ~+ [) M$ ?
| e8e14001-44d9-4ab1-a462-ea621b8a4746 | private | 79fdeabd-7f8a-4619-a17d-87864ccdfa80 10.0.0.0/24     |  5 i- x0 G  p  d! E
+--------------------------------------+---------+------------------------------------------------------+
2 p, o! v8 I0 b% }- Q复制代码6 }1 }+ r3 o) ^7 U) N

  L) c- m% p. W% D# n4 S
" J) i& c( |1 ~- F8 }) k显示某个网络详细信息
- E3 f/ `& n) w+ I[root@station140 ~(network_admin)]# neutron net-show public  
' F# m" w, O; w* |4 L+---------------------------+--------------------------------------+  3 o9 U/ l7 v$ Y6 U  D9 I
| Field                     | Value                                |  2 T7 h+ }, J; `: N$ H5 i) C. ~
+---------------------------+--------------------------------------+  4 [0 A1 w- I7 C! k% H/ x4 [, ?
| admin_state_up            | True                                 |  
7 T0 f) v0 e+ j2 p( W6 g8 N| id                        | 68a1d874-e7bd-42e2-9f86-8eb0b0b4b8fd |  9 C( v( w! K8 D7 K6 E; A' |
| name                      | public                               |  
' R* h3 a8 O; V$ O| provider:network_type     | local                                |  
" w# s% I/ h) l; k& R| provider:physical_network |                                      |  0 Y, t7 `( }3 S, S" p( J" O7 j
| provider:segmentation_id  |                                      |  
7 C( P. ~' q! l+ n$ I/ g/ t7 Z| router:external           | True                                 |  
- }% ^2 T( h( Z  r, M1 D| shared                    | False                                |  
* b: \2 E" N. @. A: Y8 M0 B| status                    | ACTIVE                               |  6 [3 i/ o4 V$ T5 R
| subnets                   | ce0a4a92-5c23-4557-ad67-97560ab5afa1 |  ; `' \, c6 W! s5 Q2 e0 E
| tenant_id                 | e3a71a59840c4e88b8740b789c3afb9c     |  
. J8 ~) ~: _) [+---------------------------+--------------------------------------+  1 I( `  r, f! a; M7 o" Y
复制代码) X/ `+ A! o, J5 X* U; ~

' t; ^/ @2 p' b
, o* D, b+ ]' D+ ]' r1 N& g0 y3 h显示网络 extension 详细信息, F% Q! X' q* b: {
[root@station140 ~(keystone_admin)]# neutron ext-list  # {3 h0 |6 W# A" p3 A( }
+-----------------------+-----------------------------------------------+  0 T4 m7 P% \2 H3 ]
| alias                 | name                                          |  
: _( }8 h0 a! o: W% F7 @" f+ @7 H- J2 T+-----------------------+-----------------------------------------------+  
$ t5 C8 N/ O: H+ I  n| ext-gw-mode           | Neutron L3 Configurable external gateway mode |  
5 i1 ?* u9 u- c& U" E| security-group        | security-group                                |  
$ h/ s6 ~. l9 e2 R! }| l3_agent_scheduler    | L3 Agent Scheduler                            |  $ P- G% U$ {) k
| provider              | Provider Network                              |  / P- S9 F, x4 B& B
| binding               | Port Binding                                  |  + e. y6 G& m5 G- p4 U  `6 R2 y2 ]- l
| quotas                | Quota management support                      |  + g: }# I9 `# r2 g1 B8 {1 y
| agent                 | agent                                         |  
! t5 ^7 g7 z; y) h3 t| dhcp_agent_scheduler  | DHCP Agent Scheduler                          |  $ x+ k- P! N8 ?) B
| external-net          | Neutron external network                      |  
. `* ~6 D. G; w8 u| router                | Neutron L3 Router                             |  2 A' x6 [! _% N! O8 m$ @
| allowed-address-pairs | Allowed Address Pairs                         |  
/ k; B3 J: r! K( W) X/ `| extra_dhcp_opt        | Neutron Extra DHCP opts                       |  ) D( S8 X4 ]* c, k& D) _2 g. v! n
| extraroute            | Neutron Extra Route                           |  
# l, Z0 X1 ]1 Z  h# @+-----------------------+-----------------------------------------------+  
4 \' w  X5 s  T复制代码
3 x  [3 V. Q! F' G. f/ f0 e$ [! c9 G7 n7 S$ B( F

% g: B# Z1 v5 K3 K2 G3 D创建私有网络: f" g4 I& I4 K9 O
[root@station140 ~(network_admin)]# neutron net-create net1  : O" g% }0 j. P4 B
Created a new network:  $ J& j; y- m; D  N2 X4 z& {6 [
+---------------------------+--------------------------------------+  * N- S! c4 s/ \
| Field                     | Value                                |  
9 y  o# d/ g; {6 X1 v4 X+ b+---------------------------+--------------------------------------+  ( a$ f9 ]! @) R4 H: W; U# @
| admin_state_up            | True                                 |  
0 v" U3 d& ?' W( z& F- w' M| id                        | d0e3f988-d62f-4f95-ab21-b73f4dae326b |  
4 n) E6 z1 I5 t0 i| name                      | net1                                 |  / g7 I+ v" [  U, ^" M
| provider:network_type     | local                                |  
+ O/ L' m' d( a; k| provider:physical_network |                                      |  
1 \( C" m( r( q7 a  u8 c% Q| provider:segmentation_id  |                                      |  & \4 s* F8 J' Q" v, a
| shared                    | False                                |  
3 N2 P+ A( O/ Z5 c6 _( r| status                    | ACTIVE                               |  
" b/ h, ]0 l; j6 B- v| subnets                   |                                      |  
' P/ r; j  \, K/ C4 S0 m- Y" T| tenant_id                 | e3a71a59840c4e88b8740b789c3afb9c     |  ) g+ [& F7 v" H& t4 o
+---------------------------+--------------------------------------+  
. E: S8 ]' w+ ~; m; H/ L复制代码3 g, g6 j3 c8 \3 f' V/ e
" P$ |/ J& T9 h  x2 f- Q$ Q

( {' O; g4 J: `; R" P% p* d显示 net1 网络详细信息' N) t+ R; S/ k1 z- [8 G
[root@station140 ~(keystone_admin)]# neutron net-show net1  
4 h4 f8 }% {8 J- N+---------------------------+--------------------------------------+  
5 e& u  J/ O# t| Field                     | Value                                |  
+ @& z' [! @6 i/ j$ V+---------------------------+--------------------------------------+  
- m* a/ a' ?8 A3 U% Q| admin_state_up            | True                                 |  
' {( O9 K+ H( `2 I; v3 K7 @. j| id                        | d0e3f988-d62f-4f95-ab21-b73f4dae326b |  
  x1 g" E9 U; m| name                      | net1                                 |  7 p% B% K1 T4 C4 `9 E
| provider:network_type     | local                                |  
# l9 f' c0 f8 P| provider:physical_network |                                      |  
5 N0 }4 [1 ^# T* l3 k( Z| provider:segmentation_id  |                                      |  " L* T& p; l! d/ A
| router:external           | False                                |  $ k1 _% X: Y* [7 s7 [% X* I
| shared                    | False                                |  
3 L" L- C/ k" z& ^: t6 @  `| status                    | ACTIVE                               |  
3 f. n" P! r+ m) p| subnets                   |                                      |  
1 u: A$ s# }* f" c9 N7 f) ~' G2 X! m| tenant_id                 | e3a71a59840c4e88b8740b789c3afb9c     |  2 Z2 y5 h9 c; n) M! O3 T
+---------------------------+--------------------------------------+  
- b$ u) E- Q5 h: R9 }复制代码
" w: N8 A3 c: ~6 }3 X4 C3 L  ]- l' [. a# k" z/ M( d* D: ]* a
- P+ N1 F8 F' ]( @: I4 w' @+ K4 z5 O
创建私网络 net1 的子网9 z4 q. E' E8 e4 _
[root@station140 ~(network_admin)]# neutron subnet-create --name terry_pri_net1 --allocation-pool start=10.0.0.50,end=10.0.0.100 --no-gateway --ip-version 4  net1 10.0.0.0/24  $ H  L) [- X( [2 `$ n! C4 a4 L
Created a new subnet:  
. D3 S; B  d' L' X  c. v1 _+------------------+---------------------------------------------+  
6 ?4 ~4 S/ P2 Q7 i% B# r4 \| Field            | Value                                       |  
' n( s3 _' H; E1 ~* P+------------------+---------------------------------------------+  
% s( E% |1 p! }- f| allocation_pools | {"start": "10.0.0.50", "end": "10.0.0.100"} |  4 J4 P, [1 ?/ Y
| cidr             | 10.0.0.0/24                                  |  7 k: x) A9 s% q8 c7 g. x0 \1 x8 R
| dns_nameservers  |                                             |  
, G6 D  K2 s+ s) D| enable_dhcp      | True                                        |  . t3 b& P- b6 O6 U
| gateway_ip       |                                             |  
- [" n+ n+ K+ `& ^| host_routes      |                                             |  
8 f% U8 G2 O' I7 L4 R) ^| id               | 3066c397-bccf-4473-8a94-72b09a97a70a        |  - M$ y* D" O3 O* z
| ip_version       | 4                                           |  
7 x! {% C  c* Y, G; R/ R# l| name             | terry_pri_net1                              |  ) m0 s" B9 y! h
| network_id       | d0e3f988-d62f-4f95-ab21-b73f4dae326b        |  
) e) N& S: e1 O% B3 _% I* }| tenant_id        | e3a71a59840c4e88b8740b789c3afb9c            |  
  ]. ^  Z; _9 Q! h+------------------+---------------------------------------------+  * D, T6 y+ J5 w; o* |
复制代码+ a, [) W4 W, m

& m- Y! f+ s3 v) A- X5 C# k! r. z' b" q* Y+ s
显示 net1 网络详细信息: k/ l" u2 ?7 C- W( q* _+ f
[root@station140 ~(keystone_admin)]# neutron net-show net1  2 ]0 I0 W4 Z4 b1 Y& [
+---------------------------+--------------------------------------+  
7 c, `! o1 l! [, v' F| Field                     | Value                                |  & Q' Z) V% d- L) w
+---------------------------+--------------------------------------+  # c* l: p2 Q' K* `/ g
| admin_state_up            | True                                 |  
0 Z+ n0 L6 H# B| id                        | d0e3f988-d62f-4f95-ab21-b73f4dae326b |  % d+ Y3 I, }  J* ~. A* J# _
| name                      | net1                                 |  
- P$ b/ D8 ?' A8 J' Y2 z| provider:network_type     | local                                |  ) _1 ~/ c0 z" |0 w. _/ W/ t$ Y
| provider:physical_network |                                      |  
4 F! }8 i* Q. }6 ]- M, k: z| provider:segmentation_id  |                                      |  3 I* Z  `1 S4 N0 x' C
| router:external           | False                                |    ?5 h6 \# f* b! |1 f
| shared                    | False                                |  5 n" J8 E- e6 c1 d" q
| status                    | ACTIVE                               |  
0 k7 f  N5 J9 W| subnets                   | 3066c397-bccf-4473-8a94-72b09a97a70a |  1 t7 q8 T) o9 B0 d
| tenant_id                 | e3a71a59840c4e88b8740b789c3afb9c     |  # Z" T* Q& N& S, k* j4 l% T& c/ `
+---------------------------+--------------------------------------+  ; H$ A( P. U6 [" {
复制代码: V# Y3 `. c! G/ _% U$ _; y
9 k" @6 G* _9 H* D: i; V' V7 p7 ^

$ d: @6 x7 }# m. O8 o/ k0 @注意 net1 中的 subnets values 部分 3066c397-bccf-4473-8a94-72b09a97a70a 显示为 terry_pri_net1 中的 ID 值

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2019-3-5 01:57:48 | 显示全部楼层

! T& i6 o$ P+ }+ Zneutron port-update --security-group 271cb2c1-503c-4b4b-a1cc-ecfea1684277  71b2ba98-c64f-45af-b5be-1c6f95c6f0ff
  L% v! Y7 A( C# o8 L# h% F  e6 F% i- H# C2 C' ~  }
' i% {4 }$ }; n
neutron port-update --no-security-groups 76f39238-86e1-4ee8-876e-b33df6fbb869
. p- G( d( _2 M5 \
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:24 , Processed in 0.024464 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表