.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::Ifconfig::Wrapper 3pm" .TH Net::Ifconfig::Wrapper 3pm "2020-04-02" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Ifconfig::Wrapper \- provides a unified way to configure network interfaces on FreeBSD, OpenBSD, Solaris, Linux, OS X, and WinNT (from Win2K). .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Net::Ifconfig::Wrapper; \& my $rhInfo = Net::Ifconfig::Wrapper::Ifconfig(\*(Aqlist\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides a unified way to configure the network interfaces on FreeBSD, OpenBSD, Solaris, Linux, \s-1OS X,\s0 and WinNT (from Win2K) systems. .PP \&\fI\f(BIOnly \f(CB\*(C`inet\*(C'\f(BI (IPv4) and \f(CB\*(C`ether\*(C'\f(BI (\s-1MAC\s0) addresses are supported at this time\fI\fR .PP On Unix, this module calls the system \f(CW\*(C`ifconfig\*(C'\fR command to gather the information. On Windows, the functions from IpHlpAPI.DLL are called. .PP For all supported Unixes, \f(CW\*(C`Net::Ifconfig::Wrapper\*(C'\fR expects the \f(CW\*(C`ifconfig\*(C'\fR command to be \f(CW\*(C`/sbin/ifconfig\*(C'\fR. .PP See the top-level \s-1README\s0 file for a list of tested OSes. .PP \&\fIOn the MSWin32 family, only Windows \s-1NT\s0 is supported. In the Windows \s-1NT\s0 family, only Windows 2000 or later is supported.\fR .SH "The Net::Ifconfig::Wrapper methods" .IX Header "The Net::Ifconfig::Wrapper methods" .ie n .IP """Ifconfig(\fICommand\fP, \fIInterface\fP, \fIAddress\fP, \fINetmask\fP);""" 4 .el .IP "\f(CWIfconfig(\f(CICommand\f(CW, \f(CIInterface\f(CW, \f(CIAddress\f(CW, \f(CINetmask\f(CW);\fR" 4 .IX Item "Ifconfig(Command, Interface, Address, Netmask);" The one and only method of the \f(CW\*(C`Net::Ifconfig::Wrapper\*(C'\fR module. Does all the jobs. The particular action is described by the \f(CW$Command\fR parameter. .Sp \&\f(CW$Command\fR could be: .RS 4 .IP "'list'" 8 .IX Item "'list'" \&\f(CW\*(C`Ifconfig(\*(Aqlist\*(Aq, \*(Aq\*(Aq, \*(Aq\*(Aq, \*(Aq\*(Aq)\*(C'\fR will return a reference to a hash containing information about interfaces. .Sp The structure of this hash is the following: .Sp .Vb 9 \& {IfaceName => {\*(Aqstatus\*(Aq => 0|1 # The status of the interface. 0 means down, 1 means up \& \*(Aqether\*(Aq => MACaddr, # The ethernet address of the interface if available \& \*(Aqdescr\*(Aq => Description, # The description of the interface if available \& \*(Aqinet\*(Aq => {IPaddr1 => NetMask, # The IP address and his netmask, both are in AAA.BBB.CCC.DDD notation \& IPaddr2 => NetMask, \& ... \& }, \& ... \& }; .Ve .Sp \&\fIInterface\fR, \fIAddress\fR, \fINetmask\fR parameters are ignored. .Sp The following shows what program is called for each \s-1OS:\s0 .RS 8 .IP "FreeBSD" 12 .IX Item "FreeBSD" \&\f(CW\*(C`/sbin/ifconfig \-a\*(C'\fR .IP "Solaris" 12 .IX Item "Solaris" \&\f(CW\*(C`/sbin/ifconfig \-a\*(C'\fR .IP "OpenBSD" 12 .IX Item "OpenBSD" \&\f(CW\*(C`/sbin/ifconfig \-A\*(C'\fR .IP "Linux" 12 .IX Item "Linux" \&\f(CW\*(C`/sbin/ifconfig \-a\*(C'\fR .IP "\s-1OS X\s0" 12 .IX Item "OS X" \&\f(CW\*(C`/sbin/ifconfig \-a\*(C'\fR .IP "MSWin32" 12 .IX Item "MSWin32" \&\f(CW\*(C`GetAdaptersInfo\*(C'\fR function from \f(CW\*(C`IpHlpAPI.DLL\*(C'\fR .RE .RS 8 .Sp Known Limitations: .Sp OpenBSD: \f(CW\*(C`/sbin/ifconfig \-A\*(C'\fR command is not returning information about \s-1MAC\s0 addresses so we are trying to get it from \f(CW\*(Aq/usr/sbin/arp \-a\*(Aq\fR command (first \fI\f(CI\*(Aqstatic\*(Aq\fI\fR entry). If no one present the \fI\f(CI\*(Aqff:ff:ff:ff:ff\*(Aq\fI\fR address is returned. .Sp MSWin32: \f(CW\*(C`GetAdaptersInfo\*(C'\fR function is not returning information about the interface which has address \f(CW127.0.0.1\fR bound to it, so we have no way to return it. .Sp Not a limitation, but a small problem: in MSWin32, interface names are not human-readable, they look like \f(CW\*(C`{843C2077\-30EC\-4C56\-A401\-658BB1E42BC7}\*(C'\fR (on Win2K at least). .RE .IP "'inet'" 8 .IX Item "'inet'" This function is used to set IPv4 address on interface. It is called as .Sp .Vb 1 \& Ifconfig(\*(Aqinet\*(Aq, $IfaceName, $Addr, $Mask); .Ve .Sp \&\fI\f(CI$IfaceName\fI\fR is an interface name as displayed by \f(CW\*(Aqlist\*(Aq\fR command .Sp \&\fI\f(CI$Addr\fI\fR is an IPv4 address in the \f(CW\*(C`AAA.AAA.AAA.AAA\*(C'\fR notation .Sp \&\fI\f(CI$Mask\fI\fR is an IPv4 subnet mask in the \f(CW\*(C`MMM.MMM.MMM.MMM\*(C'\fR notation .Sp In order to accomplish this, the following actual \f(CW\*(C`ifconfig\*(C'\fR programs are called: .RS 8 .IP "FreeBSD" 12 .IX Item "FreeBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up\*(C'\fR .IP "Solaris" 12 .IX Item "Solaris" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up\*(C'\fR .IP "OpenBSD" 12 .IX Item "OpenBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up\*(C'\fR .IP "Linux" 12 .IX Item "Linux" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up\*(C'\fR .IP "\s-1OS X\s0" 12 .IX Item "OS X" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up\*(C'\fR .IP "MSWin32:" 12 .IX Item "MSWin32:" nothing :( .RE .RS 8 .Sp Known Limitations: .Sp MSWin32: I did not find a reliable way to recognize the \*(L"main\*(R" address on the Win32 network interface, so I have disabled this functionality. If you know how, please let me know. .RE .IP "'up'" 8 .IX Item "'up'" Just a synonym for \f(CW\*(Aqinet\*(Aq\fR .IP "'down'" 8 .IX Item "'down'" This function is used to bring specified interface down. It is called as .Sp .Vb 1 \& Ifconfig(\*(Aqinet\*(Aq, $IfaceName, \*(Aq\*(Aq, \*(Aq\*(Aq); .Ve .Sp \&\fI\f(CI$IfaceName\fI\fR is an interface name as displayed by \f(CW\*(Aqlist\*(Aq\fR command .Sp Last two arguments are ignored. .Sp In order to accomplish this, the following programs are called: .RS 8 .IP "FreeBSD" 12 .IX Item "FreeBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% down\*(C'\fR .IP "Solaris" 12 .IX Item "Solaris" \&\f(CW\*(C`/sbin/ifconfig %Iface% down\*(C'\fR .IP "OpenBSD" 12 .IX Item "OpenBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% down\*(C'\fR .IP "Linux" 12 .IX Item "Linux" \&\f(CW\*(C`/sbin/ifconfig %Iface% down\*(C'\fR .IP "\s-1OS X\s0" 12 .IX Item "OS X" \&\f(CW\*(C`/sbin/ifconfig %Iface% down\*(C'\fR .IP "MSWin32" 12 .IX Item "MSWin32" Sorry, this function is not possible. .RE .RS 8 .Sp Known Limitations: .Sp MSWin32: I did not find the way to implement the \f(CW\*(Aqup\*(Aq\fR command so I did not implement \f(CW\*(Aqdown\*(Aq\fR. .RE .IP "'+alias'" 8 .IX Item "'+alias'" This function is used to set IPv4 alias address on interface. It have to be called as .Sp .Vb 1 \& Ifconfig(\*(Aq+alias\*(Aq, $IfaceName, $Addr, $Mask); .Ve .Sp \&\fI\f(CI$IfaceName\fI\fR is an interface name as displayed by \f(CW\*(Aqlist\*(Aq\fR command .Sp \&\fI\f(CI$Addr\fI\fR is an IPv4 address in the \f(CW\*(C`AAA.AAA.AAA.AAA\*(C'\fR notation .Sp \&\fI\f(CI$Mask\fI\fR is an IPv4 subnet mask in the \f(CW\*(C`MMM.MMM.MMM.MMM\*(C'\fR notation .Sp In order to accomplish this, the following \f(CW\*(C`ifconfig\*(C'\fR programs are called: .RS 8 .IP "FreeBSD" 12 .IX Item "FreeBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% alias\*(C'\fR .IP "Solaris" 12 .IX Item "Solaris" \&\f(CW\*(C`/sbin/ifconfig %Iface%:%Logic% inet %Addr% netmask %Mask% up\*(C'\fR .IP "OpenBSD" 12 .IX Item "OpenBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% alias\*(C'\fR .IP "Linux" 12 .IX Item "Linux" \&\f(CW\*(C`/sbin/ifconfig %Iface%:%Logic% inet %Addr% netmask %Mask% up\*(C'\fR .IP "\s-1OS X\s0" 12 .IX Item "OS X" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% alias\*(C'\fR .IP "MSWin32" 12 .IX Item "MSWin32" \&\f(CW\*(C`AddIPAddress\*(C'\fR function from \f(CW\*(C`IpHlpAPI.DLL\*(C'\fR .RE .RS 8 .Sp \&\fIFirst available logic interface is taken automatically for Solaris and Linux\fR .RE .IP "'alias'" 8 .IX Item "'alias'" Just a synonim for \f(CW\*(Aq+alias\*(Aq\fR .IP "'\-alias'" 8 .IX Item "'-alias'" This function is used to remove IPv4 alias address from interface. It have to be called as .Sp .Vb 1 \& Ifconfig(\*(Aq\-alias\*(Aq, $IfaceName, $Addr, \*(Aq\*(Aq); .Ve .Sp \&\fI\f(CI$IfaceName\fI\fR is an interface name as displayed by \f(CW\*(Aqlist\*(Aq\fR command. .Sp \&\fI\f(CI$Addr\fI\fR is an IPv4 address in the \f(CW\*(C`AAA.AAA.AAA.AAA\*(C'\fR notation. .Sp Last argument is ignored if present. .Sp In order to accomplish this, the following \f(CW\*(C`ifconfig\*(C'\fR programs are called: .RS 8 .IP "FreeBSD" 12 .IX Item "FreeBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% \-alias\*(C'\fR .IP "Solaris" 12 .IX Item "Solaris" \&\f(CW\*(C`/sbin/ifconfig %Iface%:%Logic% down\*(C'\fR .IP "OpenBSD" 12 .IX Item "OpenBSD" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% \-alias\*(C'\fR .IP "Linux" 12 .IX Item "Linux" \&\f(CW\*(C`/sbin/ifconfig %Iface%:%Logic% down\*(C'\fR .IP "\s-1OS X\s0" 12 .IX Item "OS X" \&\f(CW\*(C`/sbin/ifconfig %Iface% inet %Addr% \-alias\*(C'\fR .IP "MSWin32" 12 .IX Item "MSWin32" \&\f(CW\*(C`DeleteIPAddress\*(C'\fR function from \f(CW\*(C`IpHlpAPI.DLL\*(C'\fR .RE .RS 8 .Sp \&\fIAppropriate logic interface is obtained automatically for Solaris and Linux\fR .RE .RE .RS 4 .Sp On success, the \f(CW\*(C`Ifconfig(...)\*(C'\fR function returns the defined value. Actually, it is a reference to the array containing the output of the actual \fI\f(CI\*(C`ifconfig\*(C'\fI\fR program called. .Sp In case of error, \f(CW\*(C`Ifconfig(...)\*(C'\fR returns \f(CW\*(Aqundef\*(Aq\fR value, and the \f(CW$@\fR variable contains the error message. .RE .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" None by default. .SH "AUTHOR" .IX Header "AUTHOR" Daniel Podolsky, As of 2015\-11, maintained by Martin Thurn .SH "SEE ALSO" .IX Header "SEE ALSO" ifconfig(8), \fIInternet Protocol Helper\fR in \fIPlatform \s-1SDK\s0\fR.