如何在Mininet中修改host的IP地址

how to update virtual host's IP in mininet?

I got it! do like this:
mininet> py h1.setIP('10.0.0.3/24')
mininet
> py h2.setIP('10.0.0.4/24')
mininet
> h1 ping h2
PING
10.0.0.4(10.0.0.4)56(84) bytes of data.
64 bytes from10.0.0.4: icmp_req=1 ttl=64 time=2.38 ms



On Sunday, March 30, 2014 2:15:13 AM UTC+8, Yong Wang wrote:

Hi everyone,
 
When I change host's IP, other hosts cannot ping through it, but it can ping other host.
And I find that, when typing in dump command, it shows that the IP is not changed.
That's why? How can I really change the ip of virtual host?
 
mininet> h1 ifconfig h1-eth0 10.0.1.1
mininet> h1 ifconfig
h1-eth0   Link encap:Ethernet  HWaddr 00:00:00:00:00:01  
          inet addr:10.0.1.1  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::200:ff:fe00:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1543 errors:0 dropped:1302 overruns:0 frame:0
          TX packets:185 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:101016 (101.0 KB)  TX bytes:13746 (13.7 KB)
 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:336 (336.0 B)  TX bytes:336 (336.0 B)
mininet> dump
<RemoteController c0: 192.168.56.1:6633 pid=1891> 
<OVSSwitch s3: lo:127.0.0.1,s3-eth1:None,s3-eth2:None,s3-eth3:None,s3-eth4:None pid=1904> 
<Host h1: h1-eth0:10.0.0.1 pid=1898> 
<Host h2: h2-eth0:10.0.0.2 pid=1899> 
<Host h3: h3-eth0:10.0.0.3 pid=1900> 
<Host h4: h4-eth0:10.0.0.4 pid=1901> 

mininet> h1 ping h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=5.33 ms
64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.253 ms
64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.070 ms
^C
--- 10.0.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.070/1.887/5.339/2.442 ms
mininet> h2 ping h1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
From 10.0.0.2 icmp_seq=1 Destination Host Unreachable
From 10.0.0.2 icmp_seq=2 Destination Host Unreachable
From 10.0.0.2 icmp_seq=3 Destination Host Unreachable
^C
--- 10.0.0.1 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3015ms
pipe 3
mininet> 


Thank you in advance for any answers.
原文地址:https://www.cnblogs.com/duanguyuan/p/3633960.html