09-12-2013
Bash- Determine what interface is online
Hey guys, I want to use a a quick bash script/command to determine what network interface is connected to the internet so I can pipe it out to become a variable, in order so the user does not have to manually type it in each time or have to 'hardcode' the variable into the script.
I know about checking ifconfig etc of course, just looking for another way.
Many thanks and apologies for the kinda double post!
8 More Discussions You Might Find Interesting
1. Programming
Howto check if a ethernet interface is up?
It's impossible to determine via the ipaddress i have learned, or?
Can someone please give me a hint on howto do?
Environment == Linux x86 GNU GCC.
:D
regards
Esaia (2 Replies)
Discussion started by: Esaia
2 Replies
2. IP Networking
Given the interfaces on a firewall:
eth0 Link encap:Ethernet HWaddr 02:40:67:34:F5:47
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
eth1 Link encap:Ethernet HWaddr 86:23:98:45:35:56
inet addr:123.45.240.69 Bcast:255.255.255.255 ... (2 Replies)
Discussion started by: kikikaka
2 Replies
3. UNIX for Advanced & Expert Users
Hi ,
How do i check that the CPU is online/offline in a multi CPU machine in Linux ?
i tired /proc/cpuinfo
dmesg
nothing gave me the currect CPU status.
Pls help !! (5 Replies)
Discussion started by: sars
5 Replies
4. Solaris
Given a new Solaris box, with a fresh, unconfigured install on it, how does one figure out what kind of network interface it has (bge,le, hme, etc)? (8 Replies)
Discussion started by: akbar
8 Replies
5. HP-UX
Hello,
I'm writing to you because I encountered the following problem. My program displayes all network interfaces that are available in the system, but I would like to add a functionality in which a user can enter a destination address IP (ex. the IP address of the Google search engine) and will... (1 Reply)
Discussion started by: foxrafi
1 Replies
6. SCO
Hi all
I have installed a demo version of SCO OpenServer 5.0.2, I finally found it is Desktop Interface, I would like to know how to change its interface to dos based interface?
If you have any ideas, please tell me then. Thank you (2 Replies)
Discussion started by: TinhNhi
2 Replies
7. Shell Programming and Scripting
Hello,
I would like to modify an existing script of mine that uses a manually defined "MCVERSION" variable and make it define that variable instead based on this JSON file stored online:
https://s3.amazonaws.com/Minecraft.Download/versions/versions.json
Within that JSON, I 'm looking for... (4 Replies)
Discussion started by: nbsparks
4 Replies
8. Solaris
Hi Folks,
Here is one for the real Solaris aficionados on the site;
I have a T5240 and have to create an I/O domain with access to the serial port, in this case /dev/term/a and although I have been through the documentation I'm having some issues in identifying the device to assign.
What I... (2 Replies)
Discussion started by: gull04
2 Replies
VLAN(4) BSD Kernel Interfaces Manual VLAN(4)
NAME
vlan -- IEEE 802.1Q Virtual LAN network device
SYNOPSIS
pseudo-device vlan
DESCRIPTION
The vlan interface provides support for IEEE 802.1Q Virtual Local Area Networks (VLAN). This supports the trunking of more than one network
on a single network interface. This is particularly useful on routers or on hosts which must be connected to many different networks through
a single physical interface.
To use a vlan interface, the administrator must first create the interface and then specify the VID (VLAN identifier, the first 12 bits from
a 16-bit integer which distinguishes each VLAN from any others) and physical interface associated with the VLAN. This can be done by using
the ifconfig(8) create, vlan, and vlanif subcommands from a shell command line or script. From within a C program, use the ioctl(2) system
call with the SIOCSIFCREATE and SIOCSIFVLAN arguments.
To be compatible with other IEEE 802.1Q devices, the vlan interface supports a 1500 byte MTU, which means that the parent interface will have
to handle packets that are 4 bytes larger than the original Ethernet standard. Drivers supporting this increased MTU are:
- drivers using the DP8390 core (such as ec(4), ne(4), we(4), and possibly others)
- bge(4)
- bnx(4)
- ea(4)
- eb(4)
- epic(4)
- etherip(4)
- ex(4)
- fxp(4)
- gem(4)
- hme(4)
- le(4)
- sip(4)
- ste(4)
- stge(4)
- ti(4)
- tl(4)
- tlp(4)
- vge(4)
- vr(4)
- wm(4)
- xi(4)
vlan can be used with devices not supporting the IEEE 802.1Q MTU, but then the MTU of the vlan interface will be 4 bytes too small and will
not interoperate properly with other IEEE 802.1Q devices, unless the MTU of the other hosts on the VLAN are also lowered to match.
EXAMPLES
The following will create interface vlan0 with VID six, on the Ethernet interface tlp0:
ifconfig vlan0 create
ifconfig vlan0 vlan 6 vlanif tlp0
After this set up, IP addresses (and/or other protocols) can be assigned to the vlan0 interface. All other hosts on the Ethernet connected
to tlp0 which configure a VLAN and use VID six will see all traffic transmitted through vlan0.
The same VLAN can be created at system startup time by placing the following in /etc/ifconfig.vlan0:
create
vlan 6 vlanif tlp0
SEE ALSO
ifconfig(8)
HISTORY
The vlan device first appeared in NetBSD 1.5.1, and was derived from a VLAN implementation that appeared in FreeBSD and OpenBSD.
BUGS
The vlan interfaces do not currently inherit changes made to the physical interfaces' MTU.
BSD
December 16, 2010 BSD