First of all, computers don't have IP addresses. Interfaces have them. A computer typically has more than one interface,
and an interface can have more than one IP address. Furthermore, more than one interface can have the same IP
address (for instance, most computers with a TCP/IP stack
will have a loopback interface, with 127.0.0.1 as IP address).
And yes, you can change the IP address of an interface. After all, when your machine comes up, the interfaces won't have an
IP address. It's often set during, or shortly after the boot
sequence.
The same with the name of a computer. It's something that's
set during the boot process. On Unix computers, you'd use
the hostname command for that.
There's no standard way of setting hostnames or IP addresses
in Perl. The easiest way of doing so would be to call an external program. On Unix, you'd call ifconfig
(and check your systems manual for its options, it varies
from system to system) to set an IP address, and hostname to set a hostname.
On Windows, you call something else.
Abigail
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.