471,330 Members | 1,906 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

how to set local ip address using python?

6
I want to set the ip, subnet mask, default gateway.
Could anyone here give me a suggestion?
thanks
Aug 31 '07 #1
3 9741
bartonc
6,596 Expert 4TB
I want to set the ip, subnet mask, default gateway.
Could anyone here give me a suggestion?
thanks
Welcome back! I suggest that you get the book:
Python Programming on Win32 By Mark Hammond and Andy Robinson © 2000
There is a secret link given in the book for all kinds of pre-written scripts.

Alternatively, WMI may do the job. Microsoft has published example Python scripts using WMI here.

Or, you can access any win32 API using the ctyps module in that is standard in V2.5 and can be installed on earlier versions of Python.

And remember to include your OS in your post so people don't have to go searching through your posts. Thank you.
Aug 31 '07 #2
pydou
6
thanks
here is the code:
Expand|Select|Wrap|Line Numbers
  1. netobj = wmi.WMI().Win32_NetworkAdapterConfiguration( IPEnabled=True )
  2. returnValue = nic.EnableStatic(IPAddress=ip, SubnetMask=mask)
Sep 16 '07 #3
bartonc
6,596 Expert 4TB
thanks
here is the code:
Expand|Select|Wrap|Line Numbers
  1. netobj = wmi.WMI().Win32_NetworkAdapterConfiguration( IPEnabled=True )
  2. returnValue = nic.EnableStatic(IPAddress=ip, SubnetMask=mask)
Thank you for taking the time to dig up your thread. This is very helpful to every one.
Sep 16 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

23 posts views Thread by Timothy Madden | last post: by
24 posts views Thread by Daniel Crespo | last post: by
4 posts views Thread by Tom | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.