How to view your public network IP under Linux and send __linux by mail

Source: Internet
Author: User
Tags get ip
Objective:
The LAN server is connected to the extranet through the ADSL router, so a port 22 mapping on the router can ssh to the server using the IP address of the router's WAN port. But ADSL is from the ISP operator through the dynamic access to IP, how to know from the outside of the server's public network IP.
Find a way today:

1. First determine your own public network IP:
You can use the following command:
wget http://Members.3322.org/dyndns/getip
Cat getip URL http://Members.3322.org/dyndns/getip is a return to the local public network IP script page, get IP can write a script, timed to their own mailbox to send this IP address. The script also has to think about how to write.

2. Configure the Send mail client:
To install the SSL Security verification package:
sudo apt-get install ca-certificates libssl0. 9.8 OpenSSL Ssl-cert Install mutt (the shell used to send mail) and mstmp (the client that is used to send mail):
sudo apt-get install mutt MSMTP configuration mutt, modify the. muttrc file as follows:
Set editor = "Vim" # Set Default Editor
# Set up a mailbox
Set mbox = "~/mail/inbox"
Set Mbox_type = Maildir
Set spoolfile = "~/mail/inbox"
Set postponed = "~/mail/postponed"
Set record = "~/mail/sent"

# About MSMTP Settings
Set sendmail = "/usr/bin/msmtp"
Set Use_from = yes
Set from = Usr@gmail. Com
Set Envelope_from = yes

# set alternates = ' usr@gmail.com '
# This is a format string that controls the display of your index list. Its default definition is
# set Index_format = "%4c%Z%{%b%d}%-15.15l (%4l)%s"
# Specify which mailbox files you have. When you press "C" to switch the mailbox, and then press the TAB key, these mailboxes are available for you to choose
Mailboxes Mailbox Sent-mail
# This is a variant of bool. It indicates that you refer to the original message header in your reply.
Set Header = No
# can be set to Yes, no, ask-yes, or ask-no.
# This is to say, when you press Q to exit, whether prompts you (Ask-yes, ask-no),
# or simply quit (yes), or ignore you (NO).
Set quit = Ask-yes
# Those types of attachments are allowed directly through. Mailcap browsing.
Auto_view text/html
# This is also an indicative variable. It is OK when you exit, whether prompts you to put the letter
# mbox files moved from spool to.
Set move = no
# when Mutt is displayed in thread mode, whether to use pure ASCII to represent the tree list.
Set Ascii_chars = yes
# whether the original text is included in the reply.
Set include
# Insert the symbol before replying to the citation.
Set indent_str = ">"
# Set your own message headers.
My_hdr From:usr@gmail. Com
# Scoring
# New Letter + 4 points, Subject contains "notice" + 2, Subject contains "circulation" + 3, already marked
# deleted-5, last unread + 1, contains ' believe '-10 (spam ads. ) 。
Score "~n" + 4
Score "~s Notice" + 2
Score "~s Circulation" + 3
Score "~d"-5
Score "~o" + 1
Score "~s Believe"-10
# sorting method.
Set sort = Score
# When using thread sort, we have a relative sort order for each thread.
Set Sort_aux = Date
# If you turn to the end, then push down and never turn to the next letter
Set Pager_stop
# If set, when you press ' R '
# When replying, you will not be prompted to enter your return address and topic directly into the edit
Mode
Set fast_reply
# when you press "T" or "D" to mark the operation, whether to automatically move the cursor to the next letter.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.